#20 peter
Vše funguje jak má, moc děkuji za pomoc
Příspěvky odeslané z IP adresy 190.124.67.–
přepsal jsem to ve trech souborech a doplnil jsem tabulku cas v mysql
už to testuji :)
#16 peter
ok, našel jsem ještě tento souborpřikládám výňatek ze souboru:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO p_users (userID, nazev, kod, popis, foto, small_foto, kamera, aktivni, odkaz, username, password) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['userID'], "int"),
GetSQLValueString($_POST['nazev'], "text"),
GetSQLValueString($_POST['kod'], "text"),
GetSQLValueString($_POST['popis'], "text"),
GetSQLValueString("http://senderconsultants.com/vykladzive/images/img_".$_FILES["foto"] ["name"], "text"),
GetSQLValueString("http://senderconsultants.com/vykladzive/thumbnails/img_".$_FILES["foto"] ["name"], "text"),
GetSQLValueString($_POST['kamera'], "int"),
GetSQLValueString($_POST['aktivni'], "int"),
GetSQLValueString($_POST['odkaz'], "text"),
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"));
mysql_select_db($database_sender, $sender);
$Result1 = mysql_query($insertSQL, $sender) or die(mysql_error());
$insertGoTo = "../adminpage.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
}
a celý kód:
<?php require_once('../Connections/sender.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO p_users (userID, nazev, kod, popis, foto, small_foto, kamera, aktivni, odkaz, username, password) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['userID'], "int"),
GetSQLValueString($_POST['nazev'], "text"),
GetSQLValueString($_POST['kod'], "text"),
GetSQLValueString($_POST['popis'], "text"),
GetSQLValueString("http://senderconsultants.com/vykladzive/images/img_".$_FILES["foto"] ["name"], "text"),
GetSQLValueString("http://senderconsultants.com/vykladzive/thumbnails/img_".$_FILES["foto"] ["name"], "text"),
GetSQLValueString($_POST['kamera'], "int"),
GetSQLValueString($_POST['aktivni'], "int"),
GetSQLValueString($_POST['odkaz'], "text"),
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"));
mysql_select_db($database_sender, $sender);
$Result1 = mysql_query($insertSQL, $sender) or die(mysql_error());
$insertGoTo = "../adminpage.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
}
mysql_select_db($database_sender, $sender);
$query_vestci = "SELECT * FROM p_users";
$vestci = mysql_query($query_vestci, $sender) or die(mysql_error());
$row_vestci = mysql_fetch_assoc($vestci);
$totalRows_vestci = mysql_num_rows($vestci);
$colname_admin = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_admin = $_SESSION['MM_Username'];
}
mysql_select_db($database_sender, $sender);
$query_admin = sprintf("SELECT * FROM p_admin WHERE username = %s", GetSQLValueString($colname_admin, "text"));
$admin = mysql_query($query_admin, $sender) or die(mysql_error());
$row_admin = mysql_fetch_assoc($admin);
$totalRows_admin = mysql_num_rows($admin);
?>
<style type="text/css">
#add_vestec form #table_add_vestec {
color: #F5F3F8;
font-size: 14px;
font-family: Arial, Helvetica, sans-serif;
text-shadow: 0px 1px 1px #003366;
}
#add_vestec form #table_add_vestec tr td #ulozit_vestce {
background-color: #F90;
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
color: #FFFFFF;
padding-top: 8px;
padding-right: 15px;
padding-bottom: 8px;
padding-left: 15px;
border: 1px solid #07426F;
margin-bottom: 40px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
-moz-border-radius-topleft: 6px;
-moz-border-radius-topright: 6px;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
-moz-border-radius-bottomleft: 6px;
-moz-border-radius-bottomright: 6px;
-webkit-border-bottom-left-radius: 6px;
-webkit-border-bottom-right-radius: 6px;
}
#add_vestec form #table_add_vestec tr td a {
font-size: 14px;
color: #F4F4F4;
text-decoration: none;
}
.overeni {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FC0;
}
</style>
<link rel="nofollow" href="../../../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<script src="../../../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<div id="add_vestec">
<form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" name="form1">
<table align="center" id="table_add_vestec">
<tr valign="middle">
<td height="40" colspan="2" align="center" nowrap> </td>
</tr>
<tr valign="middle">
<td height="30" align="right" nowrap>Jméno věštce:</td>
<td height="30"><span id="overeni_jmena">
<input type="text" name="nazev" value="" size="32" />
</span></td>
</tr>
<tr valign="middle">
<td height="30" align="right" nowrap>Kód věštce:</td>
<td height="30"><input type="text" name="kod" value="" size="32"></td>
</tr>
<tr valign="middle">
<td height="30" align="right" nowrap>Popis služby:</td>
<td height="30"><input type="text" name="popis" value="" size="32"></td>
</tr>
<tr valign="middle">
<td height="30" align="right" nowrap>Foto:</td>
<td height="30"><label for="foto"></label>
<input type="file" name="foto" id="foto"></td>
</tr>
<tr valign="middle">
<td height="30" align="right" nowrap>Používá kameru:</td>
<td height="30"><select name="kamera">
<option value="1" <?php if (!(strcmp(1, ""))) {echo "SELECTED";} ?>>Ano</option>
<option value="0" <?php if (!(strcmp(0, ""))) {echo "SELECTED";} ?>>Ne</option>
</select></td>
</tr>
<tr valign="middle">
<td height="30" align="right" nowrap>Zobrazit mezi větci:</td>
<td height="30"><select name="aktivni">
<option value="1" <?php if (!(strcmp(1, ""))) {echo "SELECTED";} ?>>Ano</option>
<option value="0" <?php if (!(strcmp(0, ""))) {echo "SELECTED";} ?>>Ne</option>
</select></td>
</tr>
<tr valign="middle">
<td height="30" align="right" nowrap>Odkaz na stránku:</td>
<td height="30"><label for="odkaz"></label>
<input name="odkaz" type="text" id="odkaz" size="32" /></td>
</tr>
<tr valign="middle">
<td height="30" align="right" nowrap>Username:</td>
<td height="30"><span id="overeni_username">
<input type="text" name="username" value="" size="32" />
</span></td>
</tr>
<tr valign="middle">
<td height="30" align="right" nowrap>Password:</td>
<td height="30"><span id="overeni_password">
<input type="text" name="password" value="" size="32" />
</span></td>
</tr>
<tr valign="middle">
<td height="30" align="right" nowrap> </td>
<td height="30"><input id="ulozit_vestce" type="submit" value="Uložit věštce"></td>
</tr>
<tr valign="middle">
<td height="30" align="right" nowrap> </td>
<td height="30"><a rel="nofollow" href="javascript: history.go(-1)">< Zpět ></a></td>
</tr>
</table>
<input type="hidden" name="userID" value="">
<input type="hidden" name="small_foto" value="">
<input type="hidden" name="MM_insert" value="form1">
</form>
</div>
<?php
error_reporting (0);
$target = $folder."/resize_".$_FILES["foto"] ["name"];
function img_ori () {
if($_FILES["foto"] ["name"] !="" ) {
$message = "Nahrává se obrázek čekejte ....";
if( ! copy($_FILES["foto"] ["tmp_name"] , "images/ori_". $_FILES["foto"] ["name"] ) ) {
$message = "Nelze nahrát obrázek !!!";
}else {
$message = "Obrázek byl úspěšně nahrán";
}
}else{
$message = "";
}
if($message != "") {
echo "<div style='color:red;font-size:14px;'>" .$message."</div>";
}
}
function img_resize () {
if($_FILES["foto"] ["name"] !="" ) {
$message = "Nahrává se obrázek čekejte ....";
$img_file = $_FILES["foto"] ["tmp_name"];
list ($width_ori,$height_ori) = getimagesize ($img_file);
$folder = "../images/";
$folder_thumb = "../thumbnails/";
if (!is_dir($folder)) {
mkdir ($folder);
}
if (!is_dir($folder_thumb)) {
mkdir ($folder_thumb);
}
$width_new = 480;
$width_thumbnail = 71;
$ratio_ori = $width_ori / $height_ori;
$height_new = $width_new / $ratio_ori ;
$height_thumbnail = $width_thumbnail / $ratio_ori ;
$img_one = imagecreatefromjpeg ($img_file);
$img_two = imagecreatetruecolor ($width_new , $height_new);
$img_three = imagecreatetruecolor ($width_thumbnail , $height_thumbnail);
imagecopyresampled ($img_two,$img_one,0,0,0,0,$width_new,$height_new,$width_ori,$height_ori);
imagecopyresampled ($img_three,$img_one,0,0,0,0,$width_thumbnail,$height_thumbnail,$width_ori,$height_ori);
imagejpeg($img_three,$folder_thumb."/img_".$_FILES["foto"] ["name"],100);
if(imagejpeg($img_two,$folder."/img_".$_FILES["foto"] ["name"],100)){
$message = "Obrázek je nahrán!";
}
}else{
$message = "Není vybrán žádný obrázek !!!";
}
if($message != "") {
echo "";
}
}
img_resize ();
?>
<?php
mysql_free_result($vestci);
mysql_free_result($admin);
?>
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("overeni_jmena", "none");
var sprytextfield2 = new Spry.Widget.ValidationTextField("overeni_username");
var sprytextfield3 = new Spry.Widget.ValidationTextField("overeni_password");
</script>
#12 peter
ještě jsem našel jeden soubor je to ono?
<?php require_once('../../Connections/sender.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "../userlogin.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE p_users SET status=%s WHERE userID=%s",
GetSQLValueString($_POST['status'], "int"),
GetSQLValueString($_POST['userID'], "int"));
mysql_select_db($database_sender, $sender);
$Result1 = mysql_query($updateSQL, $sender) or die(mysql_error());
$updateGoTo = "userdetail.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_users = "-1";
if (isset($_SESSION['username'])) {
$colname_users = $_SESSION['username'];
}
mysql_select_db($database_sender, $sender);
$query_users = sprintf("SELECT * FROM p_users WHERE username = %s", GetSQLValueString($colname_users, "text"));
$users = mysql_query($query_users, $sender) or die(mysql_error());
$row_users = mysql_fetch_assoc($users);
$colname_users = "-1";
if (isset($_GET['MM_Username'])) {
$colname_users = $_GET['MM_Username'];
}
mysql_select_db($database_sender, $sender);
$query_users = sprintf("SELECT * FROM p_users WHERE userID = %s", GetSQLValueString($colname_users, "int"));
$users = mysql_query($query_users, $sender) or die(mysql_error());
$row_users = mysql_fetch_assoc($users);
$totalRows_users = "-1";
if (isset($_SESSION['MM_Username'])) {
$totalRows_users = $_SESSION['MM_Username'];
}
$colname_users = "-1";
mysql_select_db($database_sender, $sender);
$query_users = sprintf("SELECT * FROM p_users WHERE username = %s", GetSQLValueString($colname_users, "text"));
$users = mysql_query($query_users, $sender) or die(mysql_error());
$row_users = mysql_fetch_assoc($users);
$totalRows_users = "-1";
if (isset($_SESSION['MM_Username'])) {
$totalRows_users = $_SESSION['MM_Username'];
}
$colname_users = "-1";
mysql_select_db($database_sender, $sender);
$query_users = sprintf("SELECT * FROM p_users WHERE userID = %s", GetSQLValueString($colname_users, "int"));
$users = mysql_query($query_users, $sender) or die(mysql_error());
$row_users = mysql_fetch_assoc($users);
$totalRows_users = "-1";
if (isset($_SESSION['MM_Username'])) {
$totalRows_users = $_SESSION['MM_Username'];
}
$colname_users = "-1";
mysql_select_db($database_sender, $sender);
$query_users = "SELECT * FROM p_users WHERE username = 'MM_Username'";
$users = mysql_query($query_users, $sender) or die(mysql_error());
$row_users = mysql_fetch_assoc($users);
$totalRows_users = mysql_num_rows($users);$colname_users = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_users = $_SESSION['MM_Username'];
}
mysql_select_db($database_sender, $sender);
$query_users = sprintf("SELECT * FROM p_users WHERE username = %s", GetSQLValueString($colname_users, "text"));
$users = mysql_query($query_users, $sender) or die(mysql_error());
$row_users = mysql_fetch_assoc($users);
$totalRows_users = mysql_num_rows($users);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>vykladzive.cz - status</title>
<style type="text/css">
v mysql mám:
SELECT * FROM `p_users`
ORDER BY `p_users`.`poradi` DESC
dá se to změnit na to aby se mi to řadilo jak potřebuji nebo se mýlím?
Mám k tomu administraci kde si uživatel navolí zda je online ofline hovoří a nebo je sponzor
online uživatel má 1
hovoří má 2
ofline má 3
sponzor má 4
teď se mi to řadí: když uživatel 1 se přepne na 2, zařadí se za všechny uživatele 1,a poté co se opět přepne na 1 zařadí se na stejné místo kde byl předtím, ale já bych potřeboval aby se zařadil na poslední místo uživatelů 1
Dobrý den,
vize je taková:
aktivní uživatel má 1
čekající má 2
nepřítomen má 3
řadí se to podle toho kdy byl uživatel přidán,(takže uživatel 1 se přepne na 2, a po přepnutí na 1 se zařadí zpět na stejné místo k 1 kdy byl předtím) ale já bych potřeboval aby se to řadilo podle toho kdy uživatel má 1 a když se přepne na 2 a pak znovu na 1 tak aby se zařadil na poslední místo u uživatelů 1.
potřeboval bych pomoct s tím to kódem bohužel tomu nerozumím snad je to tento kód :
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$i=0;
mysql_select_db($database_sender, $sender);
$query_rec = "SELECT * FROM p_users WHERE aktivni=1 order by status ";
$rec = mysql_query($query_rec, $sender) or die(mysql_error());
$totalRows_rec = mysql_num_rows($rec);
while($row_rec = mysql_fetch_assoc($rec)) {?>