0){ $row55['card']++; $discont_id = $row55['card']; $result2 = mysql_query("INSERT INTO `card` (`card`,`user_id`) VALUES ('".$row55['card']."','".$user_id."')"); } echo ""; // } else { // echo""; // } } else { echo ""; } } // ============= // === Edit ==== // ============= if ((isset($_POST["send"])) && ($_POST["send"] == "edit")) { //if ($_SESSION['admin']['group']==1) { // $error=''; // $error[] = ValidFormData($_POST['user']['email'],'email','email'); // $alert=implode('\r\n',$error); // $mass=array_filter($error); // if (empty($mass)) { if ($_POST['form']['email']=='') { $_POST['form']['email']=date('d/m/y/H.i.s').'@user.com'; } // if (strpos($_POST['form']['email'],"@user.com")) { // $_POST['form']['group']=1; // } else { // $_POST['form']['group']=2; // } // Ñîáèðàåì èíòåðåñû if (isset($_POST['form']['interest'])) { $_POST['form']['interest']=implode(":",$_POST['form']['interest']); } else { $_POST['form']['interest']=''; } $birthday=$_POST['form']['year']."-".$_POST['form']['mounth']."-".$_POST['form']['day']; $sql = sprintf("UPDATE zlo_users SET email=%s, pass=%s, city=%s, address=%s, tel=%s, `group`=%s, username=%s, sex=%s, birthday=%s, interest=%s, tel2=%s WHERE id='".$_POST['user']."' ", GetSQLValueString($_POST['form']['email'], "text"), GetSQLValueString($_POST['form']['pass'], "text"), GetSQLValueString($_POST['form']['city'], "text"), GetSQLValueString($_POST['form']['address'], "text"), GetSQLValueString($_POST['form']['tel'], "text"), GetSQLValueString($_POST['form']['group'], "text"), GetSQLValueString($_POST['form']['username'], "text"), GetSQLValueString($_POST['form']['sex'], "text"), GetSQLValueString($birthday, "text"), GetSQLValueString($_POST['form']['interest'], "text"), GetSQLValueString($_POST['form']['tel2'], "text")); if($_SESSION['admin']['id']!=6 && $_SESSION['admin']['id']!=2) $result = mysql_query($sql) or die(mysql_error()); echo ""; // } else { // echo""; // } //} else {echo ""; } } // ============= // === Del ==== // ============= if ((isset($_GET["action"])) && ($_GET["action"] == "del")) { $sql = "DELETE FROM zlo_users WHERE id='".$_GET['user']."'"; $result = mysql_query($sql) or die(mysql_error()); echo ""; } // ============================== // ========== Âûâîä ============= // ============================== // ============= // ==== All ==== // ============= if (!isset($_GET['action'])) { // ***** Àäìèí ðåæèì ***** if(isset($_SESSION['admin']['edit'])) { echo"Äîáàâèòü"; } // *********************** $WHERE='ORDER BY u.id DESC'; // Åñëè ñóùåñòâóåò Ïîèñê if (isset($_POST['search'])) { $pre="u"; if($_POST['field']=='summary') {$pre="o";} $WHERE="WHERE $pre.`".$_POST['field']."` LIKE '%".trim($_POST['look'])."%'"; } // Åñëè ñóùåñòâóåò ñîðòèðîâêà if (isset($_GET['sort_by']) && isset($_GET['sort']) ) { $pre="u"; if($_GET['sort_by']=='summary') {$pre="o";} $WHERE="ORDER BY $pre.`".$_GET['sort_by']."` ".$_GET['sort']." "; } $sql = "SELECT * , u.id AS user_id, g.color FROM zlo_users AS u LEFT JOIN zlo_users_group AS g ON u.group = g.id LEFT JOIN (SELECT user_id AS order_user_id, sum( `total` ) AS `summary` FROM catalogs_orders group by user_id ) o ON u.id = o.order_user_id $WHERE"; $pager['sql']= $sql; $pager=pagerGetRun($pager,30,15); $result = mysql_query($pager['sql']) or die(mysql_error()); $th=array("id"=>"id", "username"=>"ÔÈÎ","tel"=>"òåëåôîí","email"=>"email","group"=>"Ãðóïïà", "registered"=>"Äàòà ðåã.","summary"=>"Ñóììà çàêàçà",""=>"",""=>""); if (mysql_affected_rows()!=0) { // === Ïîèñê === echo'Ýêñïîðòèðîâàòü ïîëüçîâàòåëåé'; echo""; echo"
"; foreach ($th as $key=>$value) { // Ìåíÿåì ññûëêó, ÷òî á íå áûëî äóáëÿæà $url2=urlQueryChange2('sort_by',$key); $url2=urlQueryChange2('sort','ASC',$url2); // Åñëè îòñîðòèðîâàíî ïî óáûâàíèþ ìåíÿåì íà âîçðàñòàíèå è íàîáîðîò if (isset($_GET['sort_by']) && isset($_GET['sort']) && $_GET['sort_by']==$key) { if ($_GET['sort']=='ASC') {$_GET['sort']='DESC'; } else { $_GET['sort']='ASC'; } $url2=urlQueryChange2('sort',$_GET['sort'],$url2); } echo""; } echo""; while ($user=mysql_fetch_assoc($result)){ // ïîäñ÷åò ñóììû çàêàçà $total=$user['summary']; if ($total==0) {$total=" 0";} $r = mysql_query("select id from card where user_id='{$user['user_id']}' limit 1"); $card = mysql_result($r,0); if($user['import']==1)$user['color']="yellow"; echo""; echo""; echo" "; } echo"
$value
".$user['user_id']." ".$user['username']." ".$user['tel']." ".$user['email']." ".viewBook('zlo_users_group', $user['group'], 'id','name')." ".$user['registered']." ".FreandlyDigits($total)." ãðí. Êóïîí
"; echo""; // ***** Àäìèí ðåæèì ***** if(isset($_SESSION['admin']['edit'])) { echo""; } // ************************ echo""; // ***** Àäìèí ðåæèì ***** if (isset($_SESSION['admin']['edit'])) {echo"";} if (isset($_SESSION['admin']['del'])) { echo"
";} // ************************ echo"
"; // === Pager echo"
".pagerGetShow($pager)."
"; } else { echo "Ïî äàíîìó çàïðîñó íè÷åãî íåò "; } } // ============= // ==== add ==== // ============= if (isset($_GET['action']) && $_GET['action']=='add') { echo"
"; // ===================== // === Äàòà ðîæäåíèÿ === // ===================== // äíè echo""; // ìåñÿö echo""; // ãîä echo""; echo"
"; // ãðóïïà $sql2 = "SELECT * FROM zlo_users_group"; $result2 = mysql_query($sql2) or die(mysql_error()); if (mysql_affected_rows()!=0) { echo ""; } echo"
"; // interest $sql2 = "SELECT * FROM zlo_interest ORDER BY `common` DESC"; $result2 = mysql_query($sql2) or die(mysql_error()); $total=mysql_affected_rows(); if ($total!=0) { $i=0; echo"
Ïîäïèñêà íà ðàññûëêó
"; $col=3; $perCol=ceil($total/$col); $one=0;$two=0; $j=0; // êîíâåðòèðóåì $interestMass=explode(":",$userInfo['interest']); while ($interest=mysql_fetch_assoc($result2)) { if($interest['common']==1) { $j++; if($one==0){ echo"
"; $one=1; } if (in_array($interest['id'], $interestMass)) {$checked="checked='checked'";} else {$checked='';} echo"
".$interest['title']."
"; } if($interest['common']==0) { $i++; if($one==1) { echo"
"; $one=2; } if($two==0) { echo"
"; $two=1; } if ($i==1 || $i==$perCol+1 || $i==2*$perCol+1 ) { echo"
"; } if (in_array($interest['id'], $interestMass)) {$checked="checked='checked'";} else {$checked='';} echo"
".$interest['title']."
"; if ($i==$perCol || $i==2*$perCol || $i==$total-$j) { echo"
"; } } } echo"
"; } echo"
"; // ***** Àäìèí ðåæèì ***** if(isset($_SESSION['admin']['edit'])) { echo"
"; } echo"
"; // ===================== // ===== javascript ==== // ===================== echo" "; } // ============= // === Edit ==== // ============= if (isset($_GET['action']) && $_GET['action']=='edit') { $sql = "SELECT * FROM zlo_users as u WHERE u.id=".$_GET['user']." "; $result = mysql_query($sql) or die(mysql_error()); if (mysql_affected_rows()!=0) { $userInfo=mysql_fetch_assoc($result); } echo"
"; // ===================== // === Äàòà ðîæäåíèÿ === // ===================== $dateFromDate=ExtractDate($userInfo['birthday']); // äíè echo""; // ìåñÿö echo""; // ãîä echo""; echo"
"; // ***** Àäìèí ðåæèì ***** //if (isset($_SESSION['admin']['del'])) { echo"
"; // interest $sql2 = "SELECT * FROM zlo_users_group"; $result2 = mysql_query($sql2) or die(mysql_error()); if (mysql_affected_rows()!=0) { echo ""; } echo"
"; //} // *********************** echo"
"; // interest $sql2 = "SELECT * FROM zlo_interest ORDER BY `common` DESC"; $result2 = mysql_query($sql2) or die(mysql_error()); $total=mysql_affected_rows(); if ($total!=0) { $i=0; echo"
Ïîäïèñêà íà ðàññûëêó
"; $col=3; $perCol=ceil($total/$col); $one=0;$two=0; $j=0; // êîíâåðòèðóåì $interestMass=explode(":",$userInfo['interest']); while ($interest=mysql_fetch_assoc($result2)) { if($interest['common']==1) { $j++; if($one==0){ echo"
"; $one=1; } if (in_array($interest['id'], $interestMass)) {$checked="checked='checked'";} else {$checked='';} echo"
".$interest['title']."
"; } if($interest['common']==0) { $i++; if($one==1) { echo"
"; $one=2; } if($two==0) { echo"
"; $two=1; } if ($i==1 || $i==$perCol+1 || $i==2*$perCol+1 ) { echo"
"; } if (in_array($interest['id'], $interestMass)) {$checked="checked='checked'";} else {$checked='';} echo"
".$interest['title']."
"; if ($i==$perCol || $i==2*$perCol || $i==$total-$j) { echo"
"; } } } echo"
"; } echo"
"; // ***** Àäìèí ðåæèì ***** // if(isset($_SESSION['admin']['edit'])) { echo"
"; // } echo"
"; } ?>