From 84f56040c95c8200f30ec40b2edbf5639cdc47ec Mon Sep 17 00:00:00 2001 From: andryeyev Date: Fri, 27 Nov 2015 11:04:24 +0200 Subject: [PATCH] + Редактирование телефона в заказе --- account/admin/orders-git.php | 2701 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- account/admin/orders.php | 551 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- account/admin/orders25.php | 2530 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- account/admin/orders_.php | 1699 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- account/func/func.php | 1025 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ajax/OrderContol.php | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ js/OrderContol.js | 311 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------- 7 files changed, 1003 insertions(+), 7869 deletions(-) delete mode 100644 account/admin/orders-git.php delete mode 100644 account/admin/orders25.php delete mode 100644 account/admin/orders_.php create mode 100644 ajax/OrderContol.php diff --git a/account/admin/orders-git.php b/account/admin/orders-git.php deleted file mode 100644 index 73c7e61..0000000 --- a/account/admin/orders-git.php +++ /dev/null @@ -1,2701 +0,0 @@ -"; - $result2 = mysql_query($sql2) or die(mysql_error()); - - // - $summary=$summary+($_POST['item']['quant'][$i]*$_POST['item']['price'][$i]); - } - } - } - - // ========== - // === add == - // ========== - - if (isset($ChangesOfOrder['add'])) { - - $mass=array_filter($ChangesOfOrder['add']); - if (!empty($mass)) { - - foreach ($ChangesOfOrder['add'] as $value) { - - // key() - $i=array_keys($_POST['item']['mod_id'], $value); $i=$i[0]; - - // - $sql2=sprintf("INSERT INTO catalogs_orders_products (order_id,product_id,code,product_cine_id,count,reservation) VALUES (%s,%s,%s,%s,%s,%s)", - GetSQLValueString($_POST['order_id'], "text"), - GetSQLValueString($_POST['item']['mod_id'][$i], "text"), - GetSQLValueString($_POST['item']['code'][$i], "text"), - GetSQLValueString($_POST['item']['price'][$i], "text"), - GetSQLValueString($_POST['item']['quant'][$i], "text"), - GetSQLValueString($_POST['item']['reservation'][$i], "text")); - $result2 = mysql_query($sql2) or die(mysql_error()); - - // - $summary=$summary+($_POST['item']['quant'][$i]*$_POST['item']['price'][$i]); - } - } - } - - // ========== - // == del === - // ========== - /* - if (isset($ChangesOfOrder['del'])) { - - $mass=array_filter($ChangesOfOrder['del']); - if (!empty($mass)) { - - foreach ($ChangesOfOrder['del'] as $value) { - - // - $sql2="DELETE FROM catalogs_orders_products WHERE order_id='".$_POST['order_id']."' AND product_id='".$value."'"; - $result2 = mysql_query($sql2) or die(mysql_error()); - } - } - } - */ - // =========== - // == == - // =========== - - - if (isset($summary)) { - //if(trim($_POST['label'])) $_POST['label'] = 1; -//print_r($_POST); - // - $sql2=sprintf("UPDATE catalogs_orders SET cards=%s,insurance=%s,warehouse=%s,nakladnaya=%s,cost_delivery=%s,paid=%s,cause=%s,label=%s,delivery=%s,declaration=%s,payment=%s,city=%s,adress=%s,comment=%s,mcomment=%s,total=%s,meneger=%s,check2=%s,smst=%s,dedline=%s,sumn=%s,sends=%s,work_user=%s WHERE id='".$_POST['order_id']."'", - GetSQLValueString($_POST['user']['cards'], "text"), - GetSQLValueString($_POST['user']['insurance'], "text"), - GetSQLValueString($_POST['user']['warehouse'], "text"), - GetSQLValueString($_POST['user']['nakladnaya'], "text"), - GetSQLValueString($_POST['cost_delivery'], "text"), - $_POST['paid'], - $_POST['cause'], - $_POST['label'], - $_POST['user']['delivery'], - GetSQLValueString($_POST['user']['declaration'], "text"), - GetSQLValueString($_POST['user']['payment'], "text"), - GetSQLValueString($_POST['user']['city'], "text"), - GetSQLValueString($_POST['user']['address'], "text"), - GetSQLValueString($_POST['user']['comment'], "text"), - GetSQLValueString($_POST['user']['mcomment'], "text"), - GetSQLValueString($summary, "text"), - $_POST['meneger'], - GetSQLValueString($_POST['user']['check'], "text"), - GetSQLValueString($_POST['user']['smst'], "text"), - GetSQLValueString($_POST['user']['dedline'], "text"), - GetSQLValueString($_POST['user']['sumn'], "text"), - GetSQLValueString($_POST['user']['sends'], "text"), - GetSQLValueString('0', "text") - ); - - $result2 = mysql_query($sql2) or die(mysql_error()); - - eMailing('xml',$_POST['user_id'], $_POST['order_id']); - $_SESSION['up'] = 1; - // header("location:/admin.php/orders/?page=".$_GET['page']); - } else { - - //$sql2="DELETE FROM catalogs_orders WHERE id='".$_POST['order_id']."'"; - //$result2 = mysql_query($sql2) or die(mysql_error()); - } - - // GoBack(1); - //echo""; - - } else { - - echo""; - - } - - }else{ -if(!empty($_GET['exit_order_id'])){ - $sql = sprintf("UPDATE catalogs_orders SET work_user=0 WHERE id=%d", $_GET['exit_order_id']); - - mysql_query($sql); -} -if(empty($_SESSION['up']))$_SESSION['up'] = 2; - -if(!empty($_GET['order_ID'])){ - $sql = sprintf("UPDATE catalogs_orders SET work_user=%d WHERE id=%d AND work_user=0", $_SESSION['admin']['id'], $_GET['order_ID']); - - mysql_query($sql); -} - - } - - // ============== - // ==== add ===== - // ============== - - if (isset($_POST['send']) && $_POST['send']=='add-order') { - - // - $debil==false; - - for($i=1; $i<=count($_POST['item']); $i++) { - if(isset($_POST['item']['mod_id'][$i]) && $_POST['item']['mod_id'][$i]=='') { $debil=true; } - } - - if( $debil==false) { - - // $error=''; - // $error[] = ValidFormData($_POST['user']['email'],'email','email'); - // $error[] = ValidFormData($_POST['user']['city'],'','require'); - // $error[] = ValidFormData($_POST['user']['address'],'','require'); - // $error[] = ValidFormData($_POST['user']['tel'],'.','mobile'); - // $error[] = ValidFormData($_POST['user']['username'],'','require'); - - // $alert=implode('\r\n',$error); - - // $mass=array_filter($error); - // if (empty($mass)) { - - // - // $sql="SELECT * FROM zlo_users WHERE email='".$_POST['user']['email']."' "; - // $result = mysql_query($sql) or die(mysql_error()); - // if (mysql_affected_rows()!=0) { - - // } - - $time=mktime(); - $date=date('Y-m-d H:i:s',$time); - - // - if($_POST['user']['user_id']=='' || $_POST['user']['user_id']==0 || $_POST['user']['user_id']=='0') { - - if (strpos($_POST['user']['email'],"@user.com")) { - $_POST['user']['group']=1; - } else { - $_POST['user']['group']=2; - } - - // - $pass=generate_password(6); - $sql = sprintf("INSERT INTO zlo_users (pass, email, city, address, tel, registered, username, tel2, `group`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)", - GetSQLValueString($pass, "text"), - GetSQLValueString($_POST['user']['email'], "text"), - GetSQLValueString($_POST['user']['city'], "text"), - GetSQLValueString($_POST['user']['address'], "text"), - GetSQLValueString($_POST['user']['tel'], "text"), - GetSQLValueString($date, "text"), - GetSQLValueString($_POST['user']['username'], "text"), - GetSQLValueString($_POST['user']['tel2'], "text"), - GetSQLValueString($_POST['user']['group'], "int")); - $result = mysql_query($sql) or die(mysql_error()); - - // ID - $sql="SELECT id FROM zlo_users WHERE registered='$date' AND tel='".$_POST['user']['tel']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $user=mysql_fetch_assoc($result); - - // - if($user['group']!=1) { - eMailing('reg',$user['id']); - } - - $_POST['user']['user_id']=$user['id']; - - } else { echo " ";} - - } - - // - $sql=sprintf("INSERT INTO catalogs_orders (cost_delivery,cards,insurance,warehouse,paid,label,delivery,declaration,payment,user_id,name,email,city,adress,phone,phonemob,comment,mcomment,mktime,total,sumn,sends,status) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,1)", - GetSQLValueString($_POST['cost_delivery'], "text"), - GetSQLValueString($_POST['user']['cards'], "text"), - GetSQLValueString($_POST['user']['insurance'], "text"), - GetSQLValueString($_POST['user']['warehouse'], "text"), - GetSQLValueString($_POST['paid'], "text"), - GetSQLValueString($_POST['label'], "text"), - GetSQLValueString($_POST['user']['delivery'], "text"), - GetSQLValueString($_POST['user']['declaration'], "text"), - GetSQLValueString($_POST['user']['payment'], "text"), - GetSQLValueString($_POST['user']['user_id'], "text"), - GetSQLValueString($_POST['user']['username'], "text"), - GetSQLValueString($_POST['user']['email'], "text"), - GetSQLValueString($_POST['user']['city'], "text"), - GetSQLValueString($_POST['user']['address'], "text"), - GetSQLValueString($_POST['user']['tel'], "text"), - GetSQLValueString($_POST['user']['tel2'], "text"), - GetSQLValueString($_POST['user']['comment'], "text"), - GetSQLValueString($_POST['user']['mcomment'], "text"), - GetSQLValueString($time, "text"), - GetSQLValueString($_POST['summary'], "text"), - GetSQLValueString($_POST['user']['sumn'], "text"), - GetSQLValueString($_POST['user']['sends'], "text")); - $result = mysql_query($sql) or die(mysql_error()); - - // - $sql="SELECT id FROM catalogs_orders WHERE mktime='$time' AND user_id='".$_POST['user']['user_id']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $order=mysql_fetch_assoc($result); - } else { echo "";} - - - // - for($i=0; $i<=count($_POST['item']); $i++) { - if($_POST['item']['code'][$i]!=''){ - $sql=sprintf("INSERT INTO catalogs_orders_products (order_id,product_id,code,product_cine_id,count,reservation) VALUES (%s,%s,%s,%s,%s,%s)", - GetSQLValueString($order['id'], "text"), - GetSQLValueString($_POST['item']['mod_id'][$i], "text"), - GetSQLValueString($_POST['item']['code'][$i], "text"), - GetSQLValueString($_POST['item']['price'][$i], "text"), - GetSQLValueString($_POST['item']['quant'][$i], "text"), - GetSQLValueString($_POST['item']['reservation'][$i], "text")); - $result = mysql_query($sql) or die(mysql_error()); - } - } - - // - if ($user['group']!=1) { - eMailing('order-new',$_POST['user']['user_id'], $order['id']); - } - - echo ""; - - // } else { - - // echo""; - - // } - - - } else { - - echo""; - - } - - } - - // ================= - // ==== NOTIFY ===== - // ================= - - // ============== - // == changed === - // ============== - - if (isset($_GET['notify']) && $_GET['notify']=='order-changed') { - - eMailing('order-changed',$_GET['user'], $_GET['order']); - - echo ""; - } - - - // ====================================== - // ====================================== - // ============== ================= - // ====================================== - // ====================================== - - - // ============= - // ==== all ==== - // ============= - - if (!isset($_GET['action'])) { - - echo""; - - - - // ============== - // === report === - // ============== - - - $time=''; - $time['day'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), date('j'), date('Y')); - if(date('w')==1) { - $time['week'] = " o.`mktime` >=".mktime(0, 0, 0, date('n'), date('j'), date('Y'))." "; - } else { - $time['week'] = "( o.`mktime` BETWEEN ".strtotime("last Monday")." AND ".mktime(0, 0, 0, date('n'), date('j')+1, date('Y')).") "; - } - $time['month'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), 1, date('Y')); - - Report::put_time($time); - Report::make(); - /* - echo"
"; - - // === === - - echo"
"; - - echo" : "; - echo Report::html_report(Report::get_mass_client()); - echo"
"; - - echo"
"; - - // === === - - echo"
"; - - echo" : "; - echo Report::html_report(Report::get_mass_order()); - echo"
"; - - echo"
"; - - // === === - - echo"
"; - - echo": "; - echo""; - - // - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - - echo"
"; - - echo"
";*/ - - - if (!isset($_GET['status'])) {$_GET['status']="1";} - if (!isset($_GET['page'])) {$_GET['page']="1";} - - if(isset($_GET['user'])) {$AND="AND u.id=".$_GET['user'];} else {$AND='';} - - // ============= - // === === - // ============= - - $th=array("order_id"=>" ","username"=>"", "email"=>"email", "tel"=>"", "declaration"=>" ", "nakladnaya"=>" ", "code"=>"", "mcomment"=>"" ); - - // - if (isset($_REQUEST['search'])) { - if($_REQUEST['field']=='order_id') {$pre="o";} - if($_REQUEST['field']=='username') {$pre="u";} - if($_REQUEST['field']=='email') {$pre="u";} - if($_REQUEST['field']=='tel') {$pre="u";} - if($_REQUEST['field']=='code') {$pre="m";} - if($_REQUEST['field']=='declaration') {$pre="o";} - if($_REQUEST['field']=='nakladnaya') {$pre="o";} - if($_REQUEST['field']=='mcomment') {$pre="o";} - $AND=''; - if (trim($_REQUEST['look'])!='') { - if($_REQUEST['field']=="order_id")$AND.="AND $pre.`".$_REQUEST['field']."` LIKE '".trim($_REQUEST['look'])."' "; - else $AND.="AND $pre.`".$_REQUEST['field']."` LIKE '%".trim($_REQUEST['look'])."%' "; - } - if ( ($_REQUEST['form']['date_start'] !='') && ($_REQUEST['form']['date_end'] !='')){ - - $dateStart =$_REQUEST['form']['date_start']; - $dateEnd =$_REQUEST['form']['date_end']; - - $mkdate=ExtractDate($_REQUEST['form']['date_start']); - $_REQUEST['form']['date_start'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); - - $mkdate=ExtractDate($_REQUEST['form']['date_end']); - $_REQUEST['form']['date_end'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); - - $AND.=" AND (o.`mktime` BETWEEN '".$_REQUEST['form']['date_start']."' AND '".$_REQUEST['form']['date_end']."') "; - } - } - // ============= - // === ==== - // ============= - - echo""; - - - // =========== =========== - -$eshka = ""; -$eshka2 = ""; -$eshka3 = ""; -$lll = ""; -/* -if(trim(@$_REQUEST['da'])=='1'){ - $eshka = "o.mktime<'1341090000' AND "; - $eshka2 = "o.mktime<'1341090000' AND "; - $lll = "font-weight:bold;"; -}else{ - $eshka = "o.mktime>'1341090000' AND "; - $eshka2 = "o.mktime>'1341090000' AND "; - $lll = ""; -}*/ - - - -if(trim(@$_REQUEST['pr'])=='1'){ -$tim = (time()-86400); - $eshka3 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; -}else{ -$eshka3 = ""; -} - -if(trim(@$_REQUEST['prs'])=='1'){ -$tim = (time()-172800); - $eshka4 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; -}else{ -$eshka4 = ""; -} - -$order = ((isset($_GET['order'])) ? $_GET['order'] : 'mktime'); -$type = ((isset($_GET['type'])) ? $_GET['type'] : 'DESC'); - - -if(isset($_GET['stat']) && $_GET['stat']==1){ -$AND .= " AND o.status IN(4,5) AND o.mktime<'".mktime(0, 0, 0, "01", "01", "2013")."' "; -}else{ -//$mk_and = $AND = "AND o.mktime>='".mktime(0, 0, 0, date("m"), date("d"), date("Y"))."' and o.mktime<='".mktime(0, 0, 0, date("m"), date("d")+1, date("Y"))."' "; -$AND .= " AND o.status IN(1,2) AND o.mktime>='".mktime(0, 0, 0, "01", "01", "2013")."' "; -$mk_and = " AND o.status IN(1,2) AND o.mktime>='".mktime(0, 0, 0, "01", "01", "2013")."' "; -} - -if(isset($_GET['sort_label']) && $_GET['sort_label']!=''){ -$AND .= " AND o.label='".$_GET['sort_label']."' "; -} -if(isset($_GET['lab'])){ -$AND .= " AND o.label IN(".implode(',',$_GET['lab']).")"; -} -if(isset($_GET['delivery'])){ -$AND .= " AND o.delivery IN(".implode(',',$_GET['delivery']).")"; -} -if(isset($_GET['meneger']) && $_GET['meneger']>0){ -$AND .= " AND o.meneger='".$_GET['meneger']."'"; -} - - $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, o.`mktime` as order_date, u.group, o.id as id_order, m.*, m.product_id as mod_id, op.* , p.*, g.color as group_color,za.username as meneger_name, o.order_id as order_id,adm.login as user_work_login - FROM catalogs_orders_git as o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - LEFT JOIN zlo_users as u ON u.id=o.user_id - LEFT JOIN zlo_users_group as g ON g.id=u.group - LEFT JOIN zlo_admin as za ON za.id=o.meneger - LEFT JOIN zlo_admin as adm ON adm.id=o.work_user - WHERE ".$eshka3.$eshka4.$eshka./*((!isset($_GET['search']))?"o.status='".$_GET['status']."'":"o.status>'0'").*/"1=1 $AND GROUP BY o.id ORDER BY o.$order $type "; - - $pager['sql']= $sql; - //echo $pager['sql']; - $pager=pagerGetRun($pager,50,15); - $result = mysql_query($pager['sql']) or die(mysql_error()); - if (mysql_affected_rows()!=90800) { - - - // ============= - // === ==== - // ============= - - echo"
"; - echo"
"; - //////$eshka2.$eshka - $sql0 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; - $result0 = mysql_query($sql0) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($rows=mysql_fetch_assoc($result0)) { - - //$AND - - // - $sql2 = "SELECT count(o.id) AS calc, o . * , m.*, m.product_id as mod_id, op.* , p.* - FROM catalogs_orders as o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - LEFT JOIN zlo_users as u ON u.id=o.user_id - LEFT JOIN zlo_users_group as g ON g.id=u.group - WHERE ".$eshka2."o.status='".$rows['id']."' $AND"; - - -//if(trim($_REQUEST['test'])=="1") echo $sql2; - - -/* - $sql2 = "SELECT count(o.id) AS calc FROM catalogs_orders as o WHERE ".$eshka2."o.status='".$rows['id']."'"; - - - $result2 = mysql_query($sql2) or die(mysql_error()); - $row2=mysql_fetch_assoc($result2); - $yyyyyy = str_replace("prs=1","prs=0",str_replace("pr=1","pr=0",urlQueryChange2('status',$rows['id']))); - echo"
".$rows['title']."(".$row2['calc'].")
"; - */ - } - } - -$array_label = array(0=>" ",1=>"",110=>"",2=>"",3=>"",4=>"",5=>"",510=>"",6=>"", - 7=>"",8=>"",9=>"",10=>""); -print'
-
- - - - - - - -'; -print'
'; - - - - // =================== - // === === - // =================== - $url_l = '/admin.php/orders-git/?look='.$_GET['look'].'&field='.$_GET['field'].'&form[date_start]='.$dateStart.'&form[date_end]='.$dateEnd.'&search=ok&stat='.$_GET['stat'].'&page='.$_GET['page'].'&'; - foreach($_GET['lab'] as $lab){ - $url_l .= "lab[]=".$lab."&"; - } - foreach($_GET['delivery'] as $delivery){ - $url_l .= "delivery[]=".$delivery."&"; - } - //print $url_l; - print" - - - - - - - - - - - - - - - - "; - $i1 = 0; - while ($order=mysql_fetch_assoc($result)) { - //print_r($order); - if(empty($order['order_id']))$order['order_id']=0; - print" - - - - - - - - - - - - - - "; - print""; - /* - echo"
"; - - echo"
- -
-

#".$order['order_id']."
- : ".date('Y-m-d H:i:s',$order['order_date'])." -

-
- - - - - - -
".$order['tel']." 
- - -
".$order['tel2']." 
- - -
".viewBook('zlo_users_group', $order['group'], 'id', 'name')." 
- -
- [ ] - -
- -
- - - -
".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." 
- - -
".$order['city']." 
- - -
".$order['address']." 
- - -
".$order['comment']." 
- -
- -
-
-
-
"; - */ - - // - /* - echo" -
-
- "; - echo"
{$order['id_order']}
{$order['meneger_name']}
".$order['order_id']."".$order['user_work_login']."".date('Y-m-d H:i:s',$order['order_date'])."".$order['dedline']."".$order['username']."{$order['total']} -"; - -if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4 || $_SESSION['admin']['group']==6){ -echo ""; -}else{ -if($order['paid']==1) print ""; -else print ""; -} - - -echo " -{$order['tel']}
CMC
{$order['city']}, {$order['address']}"; - - -//if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ - -if($_SESSION['admin']['group']==2 and ($order['label']==9 or $order['label']==10)){ -print $order['label']; -}else{ -echo " "; -} - -//}else{ -//print $order['label']; -//} - -$s = "select * from catalogs_orders_products where order_id=".$order['order_id']; -$r = mysql_query($s) or die(mysql_error()); -$status = array(); -while ($op=mysql_fetch_assoc($r)) { - if(!empty($op['status']))$status[] = $op['status']; -} - echo "".implode(', ',$status).""; - if(strlen($order['mcomment'])>0)print"".substr($order['mcomment'],0,30)."..."; - print"".$order['smst']."
- - - - - - - - - - - - - "; - - $sql3 = " - SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* - FROM catalogs_orders AS o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - WHERE o.id='".$order['order_id']."'"; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($item=mysql_fetch_assoc($result3)) { { $i++; - - - // - $sql5 = "SELECT c.name as city, o.count - FROM catalogs_keys_products_cities as o - LEFT JOIN catalogs_cities as c - ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStockDesc=''; } - - echo" - - - - - - - - - - - - "; - - } - - } - } - - echo"
.
$i .".$item['code']."".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."".$item['name']."".$item['size']."".$item['color']."".$item['count']."".$item['cine']."".($item['cine']*$item['count'])."".$onStockDesc."
- : ".$order['total']." . -
"; - - - - echo"
"; - */ - // ***** ***** - if(isset($_SESSION['admin']['edit1'])) { - - // - if ($order['status']!=6) { - echo " - "; - $sql4 = "SELECT * FROM zlo_book_status WHERE id IN ({$order['status']})"; - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($row4=mysql_fetch_assoc($result4)) { - if($row4['id']!="5") - echo $row4['title']; - } - - } - echo" - -
- - "; - } - - } print""; - if($order['id_order']==$_GET['order_ID']){ - - print''; - // =========== =========== - - $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, u.group, o.id as order_id, o.adress as address, g.name as user_group, g.color as user_color - FROM catalogs_orders_git as o - LEFT JOIN zlo_users as u ON u.id=o.user_id - LEFT JOIN zlo_users_group as g ON g.id=u.group - WHERE o.id='".$_GET['order_ID']."'"; - $result1 = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - - $order=mysql_fetch_assoc($result1); - - $r = mysql_query("select * from card where user_id='".$order['user_id']."'") or die(mysql_error()); - $c=mysql_fetch_assoc($r); - $order['cards'] = $c['card']; - - - echo"
"; - echo"
"; - - echo" -
-
- #".$order['order_id']."    : ".$order['user_group']."    C: ".$order['total']." . -
- -
".date('d-m-Y H:i:s',$order['mktime'])."
- -
- - -
- -
"; - - -if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4 || $_SESSION['admin']['group']==6){ -echo ""; -}else{ -if($order['paid']==1) print ""; -else print ""; -echo ""; - -} - - - - - echo "
-
- -
"; - -//////////if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ -echo ""; -////////////}else{ -//////////////echo $order['label']; -/////} - - -echo "
-
-
- - -
- -
- -
- -
- - -
- - -
- - -
- - -
- - - -
- - -
- - - -
- - -
- - -
- -
-
- - "; - global $setup; - $res = $setup->db->getAll("select * from sms_tpl",array(),DB_FETCHMODE_ASSOC); - echo " -
- -
"; - $sms_count = $setup->db->getOne("select count(*) from sms_history where order_id=?",array($order['id'])); - echo"

0 ()
"; - //echo"
"; - //echo"
- //
(".$sms_count.")
"; - echo "
"; - - echo "
-
- "; - echo " -
- -
"; - - echo " - -
"; - - echo " - -
"; - - echo " - -
"; - - $array_method = array(" "," "," "," -"," "); - echo" -
- - -
"; - - echo" -
"; - $sumn_disabled = "";if($_SESSION['admin']['id']==22 || $_SESSION['admin']['id']==7 || $_SESSION['admin']['id']==1)$sumn_disabled = "";else $sumn_disabled = "disabled"; - echo" -

"; - $array_method = array("",""); - echo" -
- - -
"; - echo" -
- - -
- - -
- - "; - $disabled = ""; - if($order['meneger']>0){ - if($_SESSION['admin']['id']!=1 and $_SESSION['admin']['id']!=7 and $_SESSION['admin']['group']!=1){$disabled = "disabled";} - } - //print_r($_SESSION['admin']['group']); - echo" -
"; - if($disabled == "disabled"){echo"";} - echo"
"; - - $disabled = ""; - if($_SESSION['admin']['id']!=7 and $_SESSION['admin']['id']!=17){$disabled = "disabled";} - echo" -
"; - if($disabled == "disabled"){echo"";} - echo" -
"; - - echo"
-
-
-
"; - - // - - $sql3 = "SELECT * FROM catalogs_orders_products_git - WHERE `order_id`='".$order['order_id']."' "; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { $i=0; - echo" -
- -
-
-
-
-
-
-
-
.
-
-
-
-
-
-
-
-
-
-
- -
-
-
1
-
- - -
-
-
- -
-
 
-
 
-
 
-
 
-
-
0
-
0
-
-
"; - echo' -
-
    -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • 2?
  • -
  • -
  • -
  • -
  • -
-
'; - echo"
"; - echo"
"; - echo" -
- - - - - - - -
- - -
- -
-
-
- - "; - - while ($item_id=mysql_fetch_assoc($result3)) { $i++; - - // - $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m - LEFT JOIN catalogs_products as p - ON p.id=m.product_id - WHERE m.code='".$item_id['code']."' "; - //WHERE m.id='".$item_id['product_id']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()==11110) { - $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m - LEFT JOIN catalogs_products as p - ON p.id=m.product_id - WHERE m.code='".$item_id['code']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - } - //if (mysql_affected_rows()!=0) { - $item=mysql_fetch_assoc($result4); - - - if(!empty($item['code'])){ - // - $sql5 = "SELECT c.name as city, o.count - FROM catalogs_keys_products_cities as o - LEFT JOIN catalogs_cities as c - ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - //print $sql5; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStock='';} - } - echo"
-
-
$i (".$item['mod_id'].")
-
"; - if($item_id['count']==0){ - echo""; - echo""; - } - else{ - echo" - - -
-
-
- "; - echo""; - } - echo" -
-
".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." 
- -
".$item['size']." 
-
".$item['color']." 
-
-
"."(".$item_id['product_cine_id'].") ".$item['cine']."
-
".($item['cine']*$item_id['count'])."
-
"; - if($item_id['count']==0){ - echo""; - echo""; - }else{ - //echo""; - echo""; - } - echo"
-
"; - echo' -
-
    -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • 2?
  • -
  • -
  • -
  • -
  • -
  • -
-
'; - echo"
"; - echo"
"; - echo" -
$onStockDesc
- - - - - - - - -
- - - -
- -
-
-
"; - - - } - - echo"
- -
- - : 0 0 . -
- - - - - - - - "; - - echo"
"; - - // XML - $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); - - // - if ($order['status']!=6) { - echo "
"; - /*"
- - "; - echo" - "; - } - - - echo"";*/ - /* if($order['work_user']>0 && $order['work_user']!=$_SESSION['admin']['id']){$r=mysql_query('select login from zlo_admin where id='.$order['work_user']);print' '.mysql_result($r,0).'';} - else - echo" - -
-
- "; - */ - /* if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { - echo"
"; - }*/ - - - echo"
"; - } - echo"
"; - - echo""; - - } - - } else { echo"

";} - - // ===================== - // ===== javascript ==== - // ===================== - - echo" - - - - "; -echo ''; - echo''; - - echo" - - - - - - - - - "; - - print''; - } - - - $i1++; - } print""; - print" - "; - - echo""; - - - - // === Pager - - echo"
- ".pagerGetShow($pager)." -
"; - - } - - } - - // =============== - // ===== show ==== - // =============== - - if (isset($_GET['action']) && $_GET['action']=='show') { - - // - - echo"
"; - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($row=mysql_fetch_assoc($result)) { - - // - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; - $result2 = mysql_query($sql2) or die(mysql_error()); - $row2=mysql_fetch_assoc($result2); - - echo"
".$row['title']."(".$row2['calc'].")
"; - } - } - echo"
-
- "; - - if(!isset($_GET['status'])) {$_GET['status']=1;} - - // =========== =========== - - $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, u.group, o.id as order_id - FROM catalogs_orders as o - LEFT JOIN zlo_users as u on u.id=o.user_id - WHERE u.id=".$_GET['user']." AND o.status=".$_GET['status']." ORDER BY mktime DESC "; - $pager['sql']= $sql; - $pager=pagerGetRun($pager,10,15); //echo$pager['sql']; - $result = mysql_query($pager['sql']) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - - // =================== - // === === - // =================== - - while ($order=mysql_fetch_assoc($result)) { - - echo"
"; - - echo"
- -
-

#".$order['order_id']."
- : ".date('Y-m-d H:i:s',$order['mktime'])." -

-
- - - - - - -
".$order['tel']." 
- - -
".$order['tel2']." 
- - -
".viewBook('zlo_users_group', $order['group'], 'id', 'name')." 
- -
- [ ] - -
- -
- - - -
".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." 
- - -
".$order['city']." 
- - -
".$order['address']." 
- - -
".$order['comment']." 
- -
- -
-
-
-
"; - - - // - - echo" -
-
- "; - echo" - - - - - - - - - - - - - "; - - $sql3 = " - SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* - FROM catalogs_orders AS o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - WHERE o.id='".$order['order_id']."'"; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($item=mysql_fetch_assoc($result3)) { { $i++; - - - // - $sql5 = "SELECT c.name as city, o.count - FROM catalogs_keys_products_cities as o - LEFT JOIN catalogs_cities as c - ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStockDesc=''; } - - echo" - - - - - - - - - - - - "; - - } - - } - } - - echo"
.
$i .".$item['code']."".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."".$item['name']."".$item['size']."".$item['color']."".$item['count']."".$item['cine']."".($item['cine']*$item['count'])."".$onStockDesc."
- : ".$order['total']." . -
"; - - - - echo"
"; - - } - - // === Pager - - echo"
- ".pagerGetShow($pager)." -
"; - } - } - - // =============== - // ===== edit ==== - // =============== - - if (isset($_GET['action']) && $_GET['action']=='edit') { - - // - - if (!isset($_GET['status'])) {$status=1;} else {$status=$_GET['status'];} - - echo"
"; - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($row=mysql_fetch_assoc($result)) { - - // - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; - $result2 = mysql_query($sql2) or die(mysql_error()); - $row2=mysql_fetch_assoc($result2); - - echo"
".$row['title']."(".$row2['calc'].")
"; - } - } - echo"
-
- "; - - - // =========== =========== - - $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, u.group, o.id as order_id, o.adress as address, g.color - FROM catalogs_orders as o - LEFT JOIN zlo_users as u ON u.id=o.user_id - LEFT JOIN zlo_users_group as g ON g.id=u.group - WHERE o.id='".$_GET['order']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - - $order=mysql_fetch_assoc($result); - - echo"
"; - echo"
"; - - echo" -
-
- #".$order['order_id']." C: ".$order['total']." . - - -
".date('Y-m-d H:i:s',$order['mktime'])."
- - -
-
- -
- - -
- -
- - -
-   - -
- - -
-   - -
- - -
-   - -
- - -
-   - -
- - "; - echo " -
- -
"; - - echo " - -
 
- - -
 
- - -
- - -
- - "; - - echo" -
-
-
"; - - // - - $sql3 = "SELECT * FROM catalogs_orders_products - WHERE `order_id`='".$order['order_id']."' "; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { $i=0; - echo" -
- -
-
-
-
-
-
-
-
.
-
-
-
-
-
-
-
- -
-
-
1
-
- - -
-
-
- -
-
 
-
 
-
 
-
 
-
-
0
-
0
-
- - - - - - - -
- - -
- -
-
-
- "; - - while ($item_id=mysql_fetch_assoc($result3)) { $i++; - - // - $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m - LEFT JOIN catalogs_products as p - ON p.id=m.product_id - WHERE m.id='".$item_id['product_id']."' "; - - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $item=mysql_fetch_assoc($result4); - - // - $sql5 = "SELECT c.name as city, o.count - FROM catalogs_keys_products_cities as o - LEFT JOIN catalogs_cities as c - ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStock='';} - - echo"
-
-
$i
-
- - -
-
-
- -
-
".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." 
- -
".$item['size']." 
-
".$item['color']." 
-
-
".$item['cine']."
-
".($item['cine']*$item_id['count'])."
-
$onStockDesc
- - - - - - - -
- - - -
- -
-
-
"; - } - - } - - echo"
- -
- : 0 0 . -
- - - - - - - - "; - - echo"
"; - - // XML - $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); - - // - if ($order['status']!=6) { - echo "
-
- - "; - echo" - "; - } - - - echo""; - - echo" -
-
-
"; - - if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { - echo"
"; - } - - - echo"
"; - } - echo"
"; - - echo""; - - } - - } else { echo"

";} - - // ===================== - // ===== javascript ==== - // ===================== - - echo" - - - - "; - - - - echo" - - - - - - - - - "; - } - - - - - // ============= - // ==== add ==== - // ============= - - if (isset($_GET['action']) && $_GET['action']=='add') { - - if (isset($_POST['user'])) {} - - $user=array(); - - if(isset($_GET['user'])) { - - $sql = "SELECT * FROM zlo_users WHERE id='".$_GET['user']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $user=mysql_fetch_assoc($result); - } - - } else { - - if(isset($_POST)) {$user=$_POST['user'];} - - } - - - - echo"
"; - echo"
"; - echo"
"; - - echo" -
-
- -
- -
".date('d-m-Y H:i:s')."
"; - - echo" -
- -
-
- -
- -
-
"; - - if(!isset($_GET['user'])) { - echo"
"; - } - - if(isset($_GET['user'])) { - - $readonly='readonly="readonly"'; - $disabled='disabled="disabled"'; - - } else {$readonly='';$disabled='';} - - echo" - -
- -
-
-
- - - -
- -
-
-
- - - - -
- - -
"; - - echo" -
- -
"; - - echo " - -
"; - - // - echo" - "; - - echo ""; - - // hidden - if (isset($_GET['user'])) { - echo""; - } - - echo""; - - echo"
- "; - echo " -
- -
"; - - echo " - -
"; - - echo " - -
"; - - - $array_method = array(" "," "," "," -"," "); - echo" -
- - -
"; - - echo" -
"; - echo" -
"; - $array_method = array("",""); - echo" -
- - -
"; - echo" -
- - -
- - -
-
- "; - - echo"
-
-
-
"; - - echo" -
- -
-
-
-
-
-
-
-
.
-
-
-
-
-
-
-
-
- -
-
-
1
-
- - -
-
-
- -
-
 
-
 
-
 
-
 
-
-
0
-
0
-
-
- - - - - - - -
- - -
- -
-
-
- -
-
-
1
-
- - -
-
-
- -
-
 
-
 
-
 
-
 
-
-
0
-
0
-
-
- - - - - - - -
- - -
- -
-
-
-
- -
- - : 0 0 . -
- - - - - -
-
- "; - - // ===================== - // ===== javascript ==== - // ===================== - - echo" - - - "; - - - echo" - - - - - - - - - "; - - } - - - // ============= - // === print === - // ============= - - if (isset($_GET['action']) && $_GET['action']=='print') { - - // =========== =========== - - if (!isset($_GET['status'])) {$_GET['status']=1;} - - $sql = "SELECT o.*,u.*, o.id as order_id,o.city as city FROM catalogs_orders as o - RIGHT JOIN zlo_users as u on u.id=o.user_id - WHERE o.id='".$_GET['order_id']."' "; - - $sql = "SELECT o.*, o.id as order_id,o.city as city,adm.login as meneger FROM catalogs_orders as o - LEFT JOIN zlo_admin adm ON adm.id=o.meneger - WHERE o.id='".$_GET['order_id']."' "; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $view=''; - $view.="
"; - - $order=mysql_fetch_assoc($result); - - $view.="
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
: ".$order['meneger']."
# ".$order['order_id']."
: ".date('Y-m-d H:i:s',$order['mktime'])."
: ".$order['name']."
Email: ".$order['email']."
: ".$order['phone']."
. : ".$order['phonemob']."
: ".$order['cards']."
: ".$order['comment']."
: ".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')."
: ".$order['declaration']."
: ".$order['warehouse']."
: ".$order['payment']."
: ".$order['insurance']."
: ".$order['sumn']."
: ".$order['sends']."
: ".$order['city']."
: ".$order['adress']."
(): ".$order['mcomment']."
-
"; - - - // - - $sql3 = "SELECT * FROM catalogs_orders_products - WHERE `order_id`='".$order['order_id']."' "; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { $i=0; - - $view.="
"; - -$sum = array(); - while ($item_id=mysql_fetch_assoc($result3)) { $i++; - - $sql4 = "SELECT *,IF(m.cine>0,m.cine,p.cine) as cine FROM catalogs_modifications as m - LEFT JOIN catalogs_products as p - ON p.id=m.product_id - WHERE m.id='".$item_id['product_id']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()==0) { - $sql4 = "SELECT m.*, m.id as mod_id, p.*,IF(m.cine>0,m.cine,p.cine) as cine from catalogs_modifications as m - LEFT JOIN catalogs_products as p - ON p.id=m.product_id - WHERE m.code='".$item_id['code']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - } - if (mysql_affected_rows()!=0) { - while ($item=mysql_fetch_assoc($result4)) { - - $view.=" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$i . ".$item['code']." ".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." ".$item['name']." ".$item['size']." ".$item['color']." .".$item_id['count']." "."(".$item_id['product_cine_id'].") ".$item['cine']." ".($item_id['product_cine_id']*$item_id['count'])." ".$item_id['reservation']."
"; - $sum[] =($item_id['product_cine_id']*$item_id['count']); - - } - - } - } - - $view.=" : ".array_sum($sum)." . - : ".$order['cost_delivery']." . -
"; - - } - - $view.="
"; - - // 2 - - echo $view; - echo "
"; - $view2=''; - $view2.="
"; - - - $view2.="
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ".$order['order_id']."
: ".date('Y-m-d H:i:s',$order['mktime'])."
: ".$order['name']."
: ".$order['phone']."
: ".$order['city']."
: ".$order['warehouse']."
: ".$order['insurance']."
: ".$order['sumn']."
: ".$order['sends']."
: ".$order['mcomment']."
-
-
"; - - echo $view2; - - - } - } -?> diff --git a/account/admin/orders.php b/account/admin/orders.php index d4d2dea..6709baf 100644 --- a/account/admin/orders.php +++ b/account/admin/orders.php @@ -32,9 +32,9 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); GoBack (1); } -// ============= -// == status === -// ============= +// ================= +// ==== status ===== +// ================= // print_r($_POST); // exit; @@ -102,9 +102,9 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); $ChangesOfOrder = ChangesOfMass ($_POST['item']['mod_id'], $ordered); - // ========== - // == same == - // ========== + // ============== + // ==== same ==== + // ============== if (isset ($ChangesOfOrder['same'])) { @@ -130,9 +130,9 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); } } - // ========== - // === add == - // ========== + // ============= + // ==== add ==== + // ============= if (isset ($ChangesOfOrder['add'])) { @@ -437,9 +437,9 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); // ==== NOTIFY ===== // ================= - // ============== - // == changed === - // ============== + // ================== + // ==== changed ===== + // ================== if (isset ($_GET['notify']) && $_GET['notify'] == 'order-changed') { @@ -454,22 +454,26 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); // ============== ================= // ====================================== // ====================================== - - // ===================== - // ===== javascript ==== - // ===================== - - + + // ===== javascript ==== + echo " - - + - "; + + + "; + // modal + echo " + + + "; + + // validator echo " - - + "; @@ -479,23 +483,7 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . "/account/func/func.php"); if (! isset ($_GET['action'])) { - - echo " - "; - // ***** ***** if (isset ($_SESSION['admin']['edit']) || $_SESSION['admin']['group'] == 4 || $_SESSION['admin']['group'] == 2) { @@ -661,65 +649,69 @@ if (! isset ($_GET['action'])) // === ==== // ============= - echo ""; // =========== =========== @@ -949,20 +941,20 @@ if (! isset ($_GET['action']))
"; echo " -
- -
-
- -
-
 
+
+ +
+ + +
+
 
"; // =================== @@ -1085,132 +1077,7 @@ if (! isset ($_GET['action'])) print " "; print "" . $order['smst'] . ""; - /* - * echo"
"; - * - * echo"
- * - *
- *

#".$order['order_id']."
- * : ".date('Y-m-d H:i:s',$order['order_date'])." - *

- *
- * - * - * - * - * - * - *
".$order['tel']." 
- * - * - *
".$order['tel2']." 
- * - * - *
".viewBook('zlo_users_group', $order['group'], 'id', 'name')." 
- * - *
- * [ ] - * - *
- * - *
- * - * - * - *
".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." 
- * - * - *
".$order['city']." 
- * - * - *
".$order['address']." 
- * - * - *
".$order['comment']." 
- * - *
- * - *
- *
- *
- *
"; - */ - - // - /* - * echo" - *
- *
- * "; - * echo" - * - * - * - * - * - * - * - * - * - * - * - * - * "; - * - * $sql3 = " - * SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* - * FROM catalogs_orders AS o - * LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - * LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - * LEFT JOIN catalogs_products AS p ON p.id = m.product_id - * WHERE o.id='".$order['order_id']."'"; - * $result3 = mysql_query($sql3) or die(mysql_error()); - * if (mysql_affected_rows()!=0) { - * while ($item=mysql_fetch_assoc($result3)) { { $i++; - * - * - * // - * $sql5 = "SELECT c.name as city, o.count - * FROM catalogs_keys_products_cities as o - * LEFT JOIN catalogs_cities as c - * ON o.city_id=c.id - * WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - * $result5 = mysql_query($sql5) or die(mysql_error()); - * if (mysql_affected_rows()!=0) { - * $onStockDesc=''; - * while ($onStock=mysql_fetch_assoc($result5)) { - * $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - * } - * } else { $onStockDesc=''; } - * - * echo" - * - * - * - * - * - * - * - * - * - * - * - * "; - * - * } - * - * } - * } - * - * echo"
.
$i .".$item['code']."".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."".$item['name']."".$item['size']."".$item['color']."".$item['count']."".$item['cine']."".($item['cine']*$item['count'])."".$onStockDesc."
- * : ".$order['total']." . - *
"; - * - * - * - * echo"
"; - */ + // ***** ***** if (isset ($_SESSION['admin']['edit1'])) { @@ -1387,22 +1254,28 @@ if (! isset ($_GET['action']))
-
+
"; + + // ==== TEL ==== + + $disabled_tel = $_SESSION['admin']['group'] == 1 ? '' : "disabled='disabled'"; + echo " -
- +
+
-
- +
+ -
+
"; + echo "
@@ -1434,25 +1307,26 @@ if (! isset ($_GET['action']))
(" . $sms_count . ")
"; echo "
"; - echo " + echo "
"; - echo " + + echo "
"; - echo " + echo "
"; - echo " + echo "
"; - echo " + echo "
"; @@ -1464,7 +1338,7 @@ if (! isset ($_GET['action'])) " ", " " ); - echo " + echo "
"; - echo " + echo "
"; $sumn_disabled = ""; if ($_SESSION['admin']['id'] == 22 || $_SESSION['admin']['id'] == 7 || $_SESSION['admin']['id'] == 1 || $_SESSION['admin']['id'] == 19) $sumn_disabled = ""; else $sumn_disabled = "disabled"; - echo " + echo "

"; $array_method = array ( "", @@ -1523,9 +1397,11 @@ if (! isset ($_GET['action'])) } } // print_r($_SESSION['admin']['group']); - echo " -
+ "; + $selected = ($order['meneger'] > 0) ? $order['meneger'] : $_SESSION['admin']['id']; $result_1 = mysql_query ("select * from zlo_admin"); @@ -1545,12 +1421,16 @@ if (! isset ($_GET['action'])) { $disabled = "disabled"; } - echo " -
"; + + echo " + +
"; + if ($disabled == "disabled") { echo ""; } + echo "
"; @@ -1559,15 +1439,15 @@ if (! isset ($_GET['action']))
"; - // - - $sql3 = "SELECT * FROM catalogs_orders_products - WHERE `order_id`='" . $order['order_id'] . "' "; - $result3 = mysql_query ($sql3) or die (mysql_error ()); - if (mysql_affected_rows () != 0) - { - $i = 0; - echo " + // + + $sql3 = "SELECT * FROM catalogs_orders_products + WHERE `order_id`='" . $order['order_id'] . "' "; + $result3 = mysql_query ($sql3) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + $i = 0; + echo "
@@ -1610,24 +1490,24 @@ if (! isset ($_GET['action']))
"; echo ' -
-
    -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • ?
  • -
  • 2?
  • -
  • ?
  • -
  • -
  • -
  • -
  • -
-
'; +
+
    +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • ?
  • +
  • 2?
  • +
  • ?
  • +
  • +
  • +
  • +
  • +
+
'; echo "
"; echo " @@ -1892,106 +1772,15 @@ if (! isset ($_GET['action'])) { echo "

"; } - - // ===================== - // ===== javascript ==== - // ===================== - - echo ' - '; - - echo ' - '; - - echo " - "; - + print ''; } $i1 ++; } - print ""; - - print ""; + echo ""; + echo "
"; // === Pager @@ -2264,14 +2053,14 @@ if (isset ($_GET['action']) && $_GET['action'] == 'edit')
- +
@@ -2301,9 +2090,9 @@ if (isset ($_GET['action']) && $_GET['action'] == 'edit') "; echo "
- +
"; echo " @@ -2526,18 +2315,6 @@ if (isset ($_GET['action']) && $_GET['action'] == 'edit') { echo "

"; } - - // ===================== - // ===== javascript ==== - // ===================== - - echo " - "; } // ============= diff --git a/account/admin/orders25.php b/account/admin/orders25.php deleted file mode 100644 index fd7f7fb..0000000 --- a/account/admin/orders25.php +++ /dev/null @@ -1,2530 +0,0 @@ -alert('$alert')"; - - } - - } - - // ============== - // ==== add ===== - // ============== - - if (isset($_POST['send']) && $_POST['send']=='add-order') { - - // - $debil==false; - - for($i=1; $i<=count($_POST['item']); $i++) { - if(isset($_POST['item']['mod_id'][$i]) && $_POST['item']['mod_id'][$i]=='') { $debil=true; } - } - - if( $debil==false) { - - // $error=''; - // $error[] = ValidFormData($_POST['user']['email'],'email','email'); - // $error[] = ValidFormData($_POST['user']['city'],'','require'); - // $error[] = ValidFormData($_POST['user']['address'],'','require'); - // $error[] = ValidFormData($_POST['user']['tel'],'.','mobile'); - // $error[] = ValidFormData($_POST['user']['username'],'','require'); - - // $alert=implode('\r\n',$error); - - // $mass=array_filter($error); - // if (empty($mass)) { - - // - // $sql="SELECT * FROM zlo_users WHERE email='".$_POST['user']['email']."' "; - // $result = mysql_query($sql) or die(mysql_error()); - // if (mysql_affected_rows()!=0) { - - // } - - $time=mktime(); - $date=date('Y-m-d H:i:s',$time); - - // - if($_POST['user']['user_id']=='' || $_POST['user']['user_id']==0 || $_POST['user']['user_id']=='0') { - - if (strpos($_POST['user']['email'],"@user.com")) { - $_POST['user']['group']=1; - } else { - $_POST['user']['group']=2; - } - - // - $pass=generate_password(6); - $sql = sprintf("INSERT INTO zlo_users (pass, email, city, address, tel, registered, username, tel2, `group`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)", - GetSQLValueString($pass, "text"), - GetSQLValueString($_POST['user']['email'], "text"), - GetSQLValueString($_POST['user']['city'], "text"), - GetSQLValueString($_POST['user']['address'], "text"), - GetSQLValueString($_POST['user']['tel'], "text"), - GetSQLValueString($date, "text"), - GetSQLValueString($_POST['user']['username'], "text"), - GetSQLValueString($_POST['user']['tel2'], "text"), - GetSQLValueString($_POST['user']['group'], "int")); - $result = mysql_query($sql) or die(mysql_error()); - - // ID - $sql="SELECT id FROM zlo_users WHERE registered='$date' AND tel='".$_POST['user']['tel']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $user=mysql_fetch_assoc($result); - - // - if($user['group']!=1) { - eMailing('reg',$user['id']); - } - - $_POST['user']['user_id']=$user['id']; - - } else { echo " ";} - - } - - // - $sql=sprintf("INSERT INTO catalogs_orders (cost_delivery,cards,insurance,warehouse,paid,label,delivery,declaration,payment,user_id,name,email,city,adress,phone,phonemob,comment,mcomment,mktime,total,status) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,1)", - GetSQLValueString($_POST['cost_delivery'], "text"), - GetSQLValueString($_POST['user']['cards'], "text"), - GetSQLValueString($_POST['user']['insurance'], "text"), - GetSQLValueString($_POST['user']['warehouse'], "text"), - GetSQLValueString($_POST['paid'], "text"), - GetSQLValueString($_POST['label'], "text"), - GetSQLValueString($_POST['user']['delivery'], "text"), - GetSQLValueString($_POST['user']['declaration'], "text"), - GetSQLValueString($_POST['user']['payment'], "text"), - GetSQLValueString($_POST['user']['user_id'], "text"), - GetSQLValueString($_POST['user']['username'], "text"), - GetSQLValueString($_POST['user']['email'], "text"), - GetSQLValueString($_POST['user']['city'], "text"), - GetSQLValueString($_POST['user']['address'], "text"), - GetSQLValueString($_POST['user']['tel'], "text"), - GetSQLValueString($_POST['user']['tel2'], "text"), - GetSQLValueString($_POST['user']['comment'], "text"), - GetSQLValueString($_POST['user']['mcomment'], "text"), - GetSQLValueString($time, "text"), - GetSQLValueString($_POST['summary'], "text")); - $result = mysql_query($sql) or die(mysql_error()); - - // - $sql="SELECT id FROM catalogs_orders WHERE mktime='$time' AND user_id='".$_POST['user']['user_id']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $order=mysql_fetch_assoc($result); - } else { echo "";} - - - // - for($i=0; $i<=count($_POST['item']); $i++) { - if($_POST['item']['code'][$i]!=''){ - $sql=sprintf("INSERT INTO catalogs_orders_products (order_id,product_id,code,product_cine_id,count,reservation) VALUES (%s,%s,%s,%s,%s,%s)", - GetSQLValueString($order['id'], "text"), - GetSQLValueString($_POST['item']['mod_id'][$i], "text"), - GetSQLValueString($_POST['item']['code'][$i], "text"), - GetSQLValueString($_POST['item']['price'][$i], "text"), - GetSQLValueString($_POST['item']['quant'][$i], "text"), - GetSQLValueString($_POST['item']['reservation'][$i], "text")); - $result = mysql_query($sql) or die(mysql_error()); - } - } - - // - if ($user['group']!=1) { - eMailing('order-new',$_POST['user']['user_id'], $order['id']); - } - - echo ""; - - // } else { - - // echo""; - - // } - - - } else { - - echo""; - - } - - } - - // ================= - // ==== NOTIFY ===== - // ================= - - // ============== - // == changed === - // ============== - - if (isset($_GET['notify']) && $_GET['notify']=='order-changed') { - - eMailing('order-changed',$_GET['user'], $_GET['order']); - - echo ""; - } - - - // ====================================== - // ====================================== - // ============== ================= - // ====================================== - // ====================================== - - - // ============= - // ==== all ==== - // ============= - - if (!isset($_GET['action'])) { - - echo""; - - // ***** ***** - if(isset($_SESSION['admin']['edit']) || $_SESSION['admin']['group']==4 || $_SESSION['admin']['group']==2) { - echo"SMS
"; - echo""; - } - // *********************** - - // ============== - // === report === - // ============== - - - $time=''; - $time['day'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), date('j'), date('Y')); - if(date('w')==1) { - $time['week'] = " o.`mktime` >=".mktime(0, 0, 0, date('n'), date('j'), date('Y'))." "; - } else { - $time['week'] = "( o.`mktime` BETWEEN ".strtotime("last Monday")." AND ".mktime(0, 0, 0, date('n'), date('j')+1, date('Y')).") "; - } - $time['month'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), 1, date('Y')); - - Report::put_time($time); - Report::make(); - /* - echo"
"; - - // === === - - echo"
"; - - echo" : "; - echo Report::html_report(Report::get_mass_client()); - echo"
"; - - echo"
"; - - // === === - - echo"
"; - - echo" : "; - echo Report::html_report(Report::get_mass_order()); - echo"
"; - - echo"
"; - - // === === - - echo"
"; - - echo": "; - echo""; - - // - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - - echo"
"; - - echo"
";*/ - - - if (!isset($_GET['status'])) {$_GET['status']="1";} - if (!isset($_GET['page'])) {$_GET['page']="1";} - - if(isset($_GET['user'])) {$AND="AND u.id=".$_GET['user'];} else {$AND='';} - - // ============= - // === === - // ============= - - $th=array("id"=>" ","username"=>"", "email"=>"email", "tel"=>"", "code"=>""); - - // - if (isset($_REQUEST['search'])) { - if($_REQUEST['field']=='id') {$pre="o";} - if($_REQUEST['field']=='username') {$pre="u";} - if($_REQUEST['field']=='email') {$pre="u";} - if($_REQUEST['field']=='tel') {$pre="u";} - if($_REQUEST['field']=='code') {$pre="m";} - $AND=''; - if (trim($_REQUEST['look'])!='') { - if($_REQUEST['field']=="id")$AND.="AND $pre.`".$_REQUEST['field']."` LIKE '".trim($_REQUEST['look'])."' "; - else $AND.="AND $pre.`".$_REQUEST['field']."` LIKE '%".trim($_REQUEST['look'])."%' "; - } - if ( ($_REQUEST['form']['date_start'] !='') && ($_REQUEST['form']['date_end'] !='')){ - - $dateStart =$_REQUEST['form']['date_start']; - $dateEnd =$_REQUEST['form']['date_end']; - - $mkdate=ExtractDate($_REQUEST['form']['date_start']); - $_REQUEST['form']['date_start'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); - - $mkdate=ExtractDate($_REQUEST['form']['date_end']); - $_REQUEST['form']['date_end'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); - - $AND.=" AND (o.`mktime` BETWEEN '".$_REQUEST['form']['date_start']."' AND '".$_REQUEST['form']['date_end']."') "; - } - } - // ============= - // === ==== - // ============= - - echo""; - - - // =========== =========== - -$eshka = ""; -$eshka2 = ""; -$eshka3 = ""; -$lll = ""; -/* -if(trim(@$_REQUEST['da'])=='1'){ - $eshka = "o.mktime<'1341090000' AND "; - $eshka2 = "o.mktime<'1341090000' AND "; - $lll = "font-weight:bold;"; -}else{ - $eshka = "o.mktime>'1341090000' AND "; - $eshka2 = "o.mktime>'1341090000' AND "; - $lll = ""; -}*/ - - - -if(trim(@$_REQUEST['pr'])=='1'){ -$tim = (time()-86400); - $eshka3 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; -}else{ -$eshka3 = ""; -} - -if(trim(@$_REQUEST['prs'])=='1'){ -$tim = (time()-172800); - $eshka4 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; -}else{ -$eshka4 = ""; -} - -$order = ((isset($_GET['order'])) ? $_GET['order'] : 'mktime'); -$type = ((isset($_GET['type'])) ? $_GET['type'] : 'DESC'); - - -if(isset($_GET['stat']) && $_GET['stat']==1){ -$AND .= " AND o.status IN(4,5) AND o.mktime<'".mktime(0, 0, 0, "01", "01", "2013")."' "; -}else{ -//$mk_and = $AND = "AND o.mktime>='".mktime(0, 0, 0, date("m"), date("d"), date("Y"))."' and o.mktime<='".mktime(0, 0, 0, date("m"), date("d")+1, date("Y"))."' "; -$AND .= " AND o.status IN(1,2) AND o.mktime>='".mktime(0, 0, 0, "01", "01", "2013")."' "; -$mk_and = " AND o.status IN(1,2) AND o.mktime>='".mktime(0, 0, 0, "01", "01", "2013")."' "; -} - -if(isset($_GET['sort_label']) && $_GET['sort_label']!=''){ -$AND .= " AND o.label='".$_GET['sort_label']."' "; -} -if(isset($_GET['lab'])){ -$AND .= " AND o.label IN(".implode(',',$_GET['lab']).")"; -} -if(isset($_GET['delivery'])){ -$AND .= " AND o.delivery IN(".implode(',',$_GET['delivery']).")"; -} -if(isset($_GET['meneger']) && $_GET['meneger']>0){ -$AND .= " AND o.meneger='".$_GET['meneger']."'"; -} - - $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, o.`mktime` as order_date, u.group, o.id as order_id, m.*, m.product_id as mod_id, op.* , p.*, g.color as group_color,za.username as meneger_name - FROM catalogs_orders as o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - LEFT JOIN zlo_users as u ON u.id=o.user_id - LEFT JOIN zlo_users_group as g ON g.id=u.group - LEFT JOIN zlo_admin as za ON za.id=o.meneger - WHERE ".$eshka3.$eshka4.$eshka./*((!isset($_GET['search']))?"o.status='".$_GET['status']."'":"o.status>'0'").*/"1=1 $AND GROUP BY o.id ORDER BY o.$order $type "; - - $pager['sql']= $sql; - //echo $pager['sql']; - $pager=pagerGetRun($pager,50,15); - $result = mysql_query($pager['sql']) or die(mysql_error()); - if (mysql_affected_rows()!=90800) { - - - // ============= - // === ==== - // ============= - - echo"
"; - echo"
"; - //////$eshka2.$eshka - $sql0 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; - $result0 = mysql_query($sql0) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($rows=mysql_fetch_assoc($result0)) { - - //$AND - - // - $sql2 = "SELECT count(o.id) AS calc, o . * , m.*, m.product_id as mod_id, op.* , p.* - FROM catalogs_orders as o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - LEFT JOIN zlo_users as u ON u.id=o.user_id - LEFT JOIN zlo_users_group as g ON g.id=u.group - WHERE ".$eshka2."o.status='".$rows['id']."' $AND"; - - -//if(trim($_REQUEST['test'])=="1") echo $sql2; - - -/* - $sql2 = "SELECT count(o.id) AS calc FROM catalogs_orders as o WHERE ".$eshka2."o.status='".$rows['id']."'"; - - - $result2 = mysql_query($sql2) or die(mysql_error()); - $row2=mysql_fetch_assoc($result2); - $yyyyyy = str_replace("prs=1","prs=0",str_replace("pr=1","pr=0",urlQueryChange2('status',$rows['id']))); - echo"
".$rows['title']."(".$row2['calc'].")
"; - */ - } - } - -$array_label = array(0=>" ",1=>"",2=>"",3=>"",4=>"",5=>"",6=>"", - 7=>"",8=>"",9=>"",10=>""); -print'
-
- - - - - - - -'; -for($i=0;$i<=10;$i++){ -$sql = "select count(*) from catalogs_orders o where o.label='".$i."'"; -if(isset($_GET['stat']) && $_GET['stat']==1){ -$sql .= " AND o.status IN(4,5)"; -}else{ -$sql .= $mk_and; -} -$r = mysql_query($sql) or die(mysql_error()); -$count = mysql_result($r,0); -print''; -} -print"


"; - -print""; - -$sql = "select * from zlo_book_delivery"; -$r = mysql_query($sql) or die(mysql_error()); -$i=0; -while ($row=mysql_fetch_assoc($r)) { -print''; -$i++; -} -print'
'; - -$tim = (time()-86400); - $sql3 = " - SELECT count(*) count FROM catalogs_orders WHERE `status`=1 AND `upd`<'".date("Y-m-d H:i:s",$tim)."';"; - $result3 = mysql_query($sql3) or die(mysql_error()); - $row3=mysql_fetch_assoc($result3); -$yyyyyt = ""; -if(trim($_REQUEST['pr'])=="1") $yyyyyt = "font-weight:bold; "; - -$tim2 = (time()-172800); - $sql4 = " - SELECT count(*) count FROM catalogs_orders WHERE `status`=2 AND `upd`<'".date("Y-m-d H:i:s",$tim2)."';"; - $result4 = mysql_query($sql4) or die(mysql_error()); - $row4=mysql_fetch_assoc($result4); -$yyyyyt2 = ""; -if(trim($_REQUEST['prs'])=="1") $yyyyyt2 = "font-weight:bold; "; - - - echo" - -
"; - echo" -
- -
-
- -
-
 
- "; - - // =================== - // === === - // =================== - $url_l = '/admin.php/orders/?look='.$_GET['look'].'&field='.$_GET['field'].'&form[date_start]='.$dateStart.'&form[date_end]='.$dateEnd.'&search=ok&stat='.$_GET['stat'].'&page='.$_GET['page'].'&'; - foreach($_GET['lab'] as $lab){ - $url_l .= "lab[]=".$lab."&"; - } - foreach($_GET['delivery'] as $delivery){ - $url_l .= "delivery[]=".$delivery."&"; - } - //print $url_l; - print" - - - - - - - - - - - "; - $i1 = 0; - while ($order=mysql_fetch_assoc($result)) { - //print_r($order); - print" - - - - - - - - - - "; - /* - echo"
"; - - echo"
- -
-

#".$order['order_id']."
- : ".date('Y-m-d H:i:s',$order['order_date'])." -

-
- - - - - - -
".$order['tel']." 
- - -
".$order['tel2']." 
- - -
".viewBook('zlo_users_group', $order['group'], 'id', 'name')." 
- -
- [ ] - -
- -
- - - -
".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." 
- - -
".$order['city']." 
- - -
".$order['address']." 
- - -
".$order['comment']." 
- -
- -
-
-
-
"; - */ - - // - /* - echo" -
-
- "; - echo"
{$order['order_id']}
{$order['meneger_name']}
".date('Y-m-d H:i:s',$order['order_date'])."".$order['username']."{$order['total']} -"; - -if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ -echo ""; -}else{ -if($order['paid']==1) print ""; -else print ""; -} - - -echo " -{$order['tel']}
CMC
{$order['city']}, {$order['address']}"; - - -//if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ - -if($_SESSION['admin']['group']==2 and ($order['label']==9 or $order['label']==10)){ -print $order['label']; -}else{ -echo " "; -} - -//}else{ -//print $order['label']; -//} - - - echo ""; - if(strlen($order['mcomment'])>0)print"".substr($order['mcomment'],0,30)."..."; - print"
- - - - - - - - - - - - - "; - - $sql3 = " - SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* - FROM catalogs_orders AS o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - WHERE o.id='".$order['order_id']."'"; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($item=mysql_fetch_assoc($result3)) { { $i++; - - - // - $sql5 = "SELECT c.name as city, o.count - FROM catalogs_keys_products_cities as o - LEFT JOIN catalogs_cities as c - ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStockDesc=''; } - - echo" - - - - - - - - - - - - "; - - } - - } - } - - echo"
.
$i .".$item['code']."".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."".$item['name']."".$item['size']."".$item['color']."".$item['count']."".$item['cine']."".($item['cine']*$item['count'])."".$onStockDesc."
- : ".$order['total']." . -
"; - - - - echo"
"; - */ - // ***** ***** - if(isset($_SESSION['admin']['edit1'])) { - - // - if ($order['status']!=6) { - echo " - "; - $sql4 = "SELECT * FROM zlo_book_status WHERE id IN ({$order['status']})"; - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($row4=mysql_fetch_assoc($result4)) { - if($row4['id']!="5") - echo $row4['title']; - } - - } - echo" - -
- - "; - } - - } print""; - if($order['order_id']==$_GET['order_ID']){ - print''; - // =========== =========== - - $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, u.group, o.id as order_id, o.adress as address, g.name as user_group, g.color as user_color - FROM catalogs_orders as o - LEFT JOIN zlo_users as u ON u.id=o.user_id - LEFT JOIN zlo_users_group as g ON g.id=u.group - WHERE o.id='".$_GET['order_ID']."'"; - $result1 = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - - $order=mysql_fetch_assoc($result1); - - $r = mysql_query("select * from card where user_id='".$order['user_id']."'") or die(mysql_error()); - $c=mysql_fetch_assoc($r); - $order['cards'] = $c['card']; - - - echo"
"; - echo"
"; - - echo" -
-
- #".$order['order_id']."    : ".$order['user_group']."    C: ".$order['total']." . -
- -
".date('d-m-Y H:i:s',$order['mktime'])."
- - -
"; - - -if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ -echo ""; -}else{ -if($order['paid']==1) print ""; -else print ""; -echo ""; - -} - - - - - echo "
-
- -
"; - -//////////if($_SESSION['admin']['group']==1 || $_SESSION['admin']['group']==4){ -echo ""; -////////////}else{ -//////////////echo $order['label']; -/////} - - -echo "
-
-
- - -
- -
- -
- -
- - -
- - -
- - -
- - -
- - - -
- - -
- - - -
- - -
- - -
- -
-
- - "; - global $setup; - $res = $setup->db->getAll("select * from sms_tpl",array(),DB_FETCHMODE_ASSOC); - echo " -
- -
"; - $sms_count = $setup->db->getOne("select count(*) from sms_history where order_id=?",array($order['id'])); - echo"

0 ()
"; - echo"
"; - echo"
-
(".$sms_count.")
"; - echo "
"; - - echo "
-
- "; - echo " -
- -
"; - - echo " - -
"; - - echo " - -
"; - - - $array_method = array(" "," "," "," -"); - echo" -
- - -
"; - - echo" -
"; - - echo" -
- - -
- - -
- - "; - $disabled = ""; - if($order['meneger']>0){ - if($_SESSION['admin']['id']!=1 and $_SESSION['admin']['id']!=7){$disabled = "disabled";} - } - echo" -
"; - if($disabled == "disabled"){echo"";} - echo"
"; - - echo"
-
-
-
"; - - // - - $sql3 = "SELECT * FROM catalogs_orders_products - WHERE `order_id`='".$order['order_id']."' "; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { $i=0; - echo" -
- -
-
-
-
-
-
-
-
.
-
-
-
-
-
-
-
-
- -
-
-
1
-
- - -
-
-
- -
-
 
-
 
-
 
-
 
-
-
0
-
0
-
-
- - - - - - - -
- - -
- -
-
-
- - "; - - while ($item_id=mysql_fetch_assoc($result3)) { $i++; - - // - $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m - LEFT JOIN catalogs_products as p - ON p.id=m.product_id - WHERE m.id='".$item_id['product_id']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()==0) { - $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m - LEFT JOIN catalogs_products as p - ON p.id=m.product_id - WHERE m.code='".$item_id['code']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - } - if (mysql_affected_rows()!=0) { - $item=mysql_fetch_assoc($result4); - - // - $sql5 = "SELECT c.name as city, o.count - FROM catalogs_keys_products_cities as o - LEFT JOIN catalogs_cities as c - ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStock='';} - - echo"
-
-
$i
-
"; - if($item_id['count']==0){ - echo""; - echo""; - } - else{ - echo" - - -
-
-
- "; - } - echo" -
-
".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." 
- -
".$item['size']." 
-
".$item['color']." 
-
-
".$item['cine']."
-
".($item['cine']*$item_id['count'])."
-
"; - if($item_id['count']==0){ - echo""; - echo""; - }else{ - echo""; - } - echo"
-
$onStockDesc
- - - - - - - - -
- - - -
- -
-
-
"; - } - - } - - echo"
- -
- - : 0 0 . -
- - - - - - - - "; - - echo"
"; - - // XML - $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); - - // - if ($order['status']!=6) { - echo "
"; - /*"
- - "; - echo" - "; - } - - - echo"";*/ - - echo" - -
-
"; - - /* if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { - echo"
"; - }*/ - - - echo"
"; - } - echo"
"; - - echo""; - - } - - } else { echo"

";} - - // ===================== - // ===== javascript ==== - // ===================== - - echo" - - - - "; - - echo''; - - echo" - - - - - - - - - "; - - print''; - } - - - $i1++; - } print""; - print" - "; - - echo""; - - - - // === Pager - - echo"
- ".pagerGetShow($pager)." -
"; - - } - - } - - // =============== - // ===== show ==== - // =============== - - if (isset($_GET['action']) && $_GET['action']=='show') { - - // - - echo"
"; - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($row=mysql_fetch_assoc($result)) { - - // - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; - $result2 = mysql_query($sql2) or die(mysql_error()); - $row2=mysql_fetch_assoc($result2); - - echo"
".$row['title']."(".$row2['calc'].")
"; - } - } - echo"
-
- "; - - if(!isset($_GET['status'])) {$_GET['status']=1;} - - // =========== =========== - - $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, u.group, o.id as order_id - FROM catalogs_orders as o - LEFT JOIN zlo_users as u on u.id=o.user_id - WHERE u.id=".$_GET['user']." AND o.status=".$_GET['status']." ORDER BY mktime DESC "; - $pager['sql']= $sql; - $pager=pagerGetRun($pager,10,15); //echo$pager['sql']; - $result = mysql_query($pager['sql']) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - - // =================== - // === === - // =================== - - while ($order=mysql_fetch_assoc($result)) { - - echo"
"; - - echo"
- -
-

#".$order['order_id']."
- : ".date('Y-m-d H:i:s',$order['mktime'])." -

-
- - - - - - -
".$order['tel']." 
- - -
".$order['tel2']." 
- - -
".viewBook('zlo_users_group', $order['group'], 'id', 'name')." 
- -
- [ ] - -
- -
- - - -
".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." 
- - -
".$order['city']." 
- - -
".$order['address']." 
- - -
".$order['comment']." 
- -
- -
-
-
-
"; - - - // - - echo" -
-
- "; - echo" - - - - - - - - - - - - - "; - - $sql3 = " - SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* - FROM catalogs_orders AS o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - WHERE o.id='".$order['order_id']."'"; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($item=mysql_fetch_assoc($result3)) { { $i++; - - - // - $sql5 = "SELECT c.name as city, o.count - FROM catalogs_keys_products_cities as o - LEFT JOIN catalogs_cities as c - ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStockDesc=''; } - - echo" - - - - - - - - - - - - "; - - } - - } - } - - echo"
.
$i .".$item['code']."".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."".$item['name']."".$item['size']."".$item['color']."".$item['count']."".$item['cine']."".($item['cine']*$item['count'])."".$onStockDesc."
- : ".$order['total']." . -
"; - - - - echo"
"; - - } - - // === Pager - - echo"
- ".pagerGetShow($pager)." -
"; - } - } - - // =============== - // ===== edit ==== - // =============== - - if (isset($_GET['action']) && $_GET['action']=='edit') { - - // - - if (!isset($_GET['status'])) {$status=1;} else {$status=$_GET['status'];} - - echo"
"; - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($row=mysql_fetch_assoc($result)) { - - // - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; - $result2 = mysql_query($sql2) or die(mysql_error()); - $row2=mysql_fetch_assoc($result2); - - echo"
".$row['title']."(".$row2['calc'].")
"; - } - } - echo"
-
- "; - - - // =========== =========== - - $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, u.group, o.id as order_id, o.adress as address, g.color - FROM catalogs_orders as o - LEFT JOIN zlo_users as u ON u.id=o.user_id - LEFT JOIN zlo_users_group as g ON g.id=u.group - WHERE o.id='".$_GET['order']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - - $order=mysql_fetch_assoc($result); - - echo"
"; - echo"
"; - - echo" -
-
- #".$order['order_id']." C: ".$order['total']." . - - -
".date('Y-m-d H:i:s',$order['mktime'])."
- - -
-
- -
- - -
- -
- - -
-   - -
- - -
-   - -
- - -
-   - -
- - -
-   - -
- - "; - echo " -
- -
"; - - echo " - -
 
- - -
 
- - -
- - -
- - "; - - echo" -
-
-
"; - - // - - $sql3 = "SELECT * FROM catalogs_orders_products - WHERE `order_id`='".$order['order_id']."' "; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { $i=0; - echo" -
- -
-
-
-
-
-
-
-
.
-
-
-
-
-
-
-
- -
-
-
1
-
- - -
-
-
- -
-
 
-
 
-
 
-
 
-
-
0
-
0
-
- - - - - - - -
- - -
- -
-
-
- "; - - while ($item_id=mysql_fetch_assoc($result3)) { $i++; - - // - $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m - LEFT JOIN catalogs_products as p - ON p.id=m.product_id - WHERE m.id='".$item_id['product_id']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $item=mysql_fetch_assoc($result4); - - // - $sql5 = "SELECT c.name as city, o.count - FROM catalogs_keys_products_cities as o - LEFT JOIN catalogs_cities as c - ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStock='';} - - echo"
-
-
$i
-
- - -
-
-
- -
-
".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." 
- -
".$item['size']." 
-
".$item['color']." 
-
-
".$item['cine']."
-
".($item['cine']*$item_id['count'])."
-
$onStockDesc
- - - - - - - -
- - - -
- -
-
-
"; - } - - } - - echo"
- -
- : 0 0 . -
- - - - - - - - "; - - echo"
"; - - // XML - $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); - - // - if ($order['status']!=6) { - echo "
-
- - "; - echo" - "; - } - - - echo""; - - echo" -
-
-
"; - - if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { - echo"
"; - } - - - echo"
"; - } - echo"
"; - - echo""; - - } - - } else { echo"

";} - - // ===================== - // ===== javascript ==== - // ===================== - - echo" - - - - "; - - - - echo" - - - - - - - - - "; - } - - - - - // ============= - // ==== add ==== - // ============= - - if (isset($_GET['action']) && $_GET['action']=='add') { - - if (isset($_POST['user'])) {} - - $user=array(); - - if(isset($_GET['user'])) { - - $sql = "SELECT * FROM zlo_users WHERE id='".$_GET['user']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $user=mysql_fetch_assoc($result); - } - - } else { - - if(isset($_POST)) {$user=$_POST['user'];} - - } - - - - echo"
"; - echo"
"; - echo"
"; - - echo" -
-
- -
- -
".date('d-m-Y H:i:s')."
"; - - echo" -
- -
-
- -
- -
-
"; - - if(!isset($_GET['user'])) { - echo"
"; - } - - if(isset($_GET['user'])) { - - $readonly='readonly="readonly"'; - $disabled='disabled="disabled"'; - - } else {$readonly='';$disabled='';} - - echo" - -
- -
-
-
- - - -
- -
-
-
- - - - -
- - -
"; - - echo" -
- -
"; - - echo " - -
"; - - // - echo" - "; - - echo ""; - - // hidden - if (isset($_GET['user'])) { - echo""; - } - - echo""; - - echo"
- "; - echo " -
- -
"; - - echo " - -
"; - - echo " - -
"; - - - $array_method = array(" "," "," "," -"); - echo" -
- - -
"; - - echo" -
"; - - echo" -
- - -
- - -
-
- "; - - echo"
-
-
-
"; - - echo" -
- -
-
-
-
-
-
-
-
.
-
-
-
-
-
-
-
-
- -
-
-
1
-
- - -
-
-
- -
-
 
-
 
-
 
-
 
-
-
0
-
0
-
-
- - - - - - - -
- - -
- -
-
-
- -
-
-
1
-
- - -
-
-
- -
-
 
-
 
-
 
-
 
-
-
0
-
0
-
-
- - - - - - - -
- - -
- -
-
-
-
- -
- - : 0 0 . -
- - - - - -
-
- "; - - // ===================== - // ===== javascript ==== - // ===================== - - echo" - - - "; - - - echo" - - - - - - - - - "; - - } - - - // ============= - // === print === - // ============= - - if (isset($_GET['action']) && $_GET['action']=='print') { - - // =========== =========== - - if (!isset($_GET['status'])) {$_GET['status']=1;} - - $sql = "SELECT o.*,u.*, o.id as order_id,o.city as city FROM catalogs_orders as o - RIGHT JOIN zlo_users as u on u.id=o.user_id - WHERE o.id='".$_GET['order_id']."' "; - - $sql = "SELECT o.*, o.id as order_id,o.city as city FROM catalogs_orders as o - WHERE o.id='".$_GET['order_id']."' "; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $view=''; - $view.="
"; - - $order=mysql_fetch_assoc($result); - - $view.="
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ".$order['order_id']."
: ".date('Y-m-d H:i:s',$order['mktime'])."
: ".$order['name']."
Email: ".$order['email']."
: ".$order['phone']."
. : ".$order['tel2']."
: ".$order['cards']."
: ".$order['comment']."
: ".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')."
: ".$order['declaration']."
: ".$order['warehouse']."
: ".$order['payment']."
: ".$order['insurance']."
: ".$order['city']."
: ".$order['adress']."
(): ".$order['mcomment']."
-
"; - - - // - - $sql3 = "SELECT * FROM catalogs_orders_products - WHERE `order_id`='".$order['order_id']."' "; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { $i=0; - - $view.="
"; - - - while ($item_id=mysql_fetch_assoc($result3)) { $i++; - - $sql4 = "SELECT * FROM catalogs_modifications as m - LEFT JOIN catalogs_products as p - ON p.id=m.product_id - WHERE m.id='".$item_id['product_id']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($item=mysql_fetch_assoc($result4)) { - - $view.=" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$i . ".$item['code']." ".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." ".$item['name']." ".$item['size']." ".$item['color']." .".$item_id['count']." ".$item['cine']." ".($item['cine']*$item_id['count'])." ".$item_id['reservation']."
"; - - } - - } - } - - $view.=" : ".$order['total']." . - : ".$order['cost_delivery']." . -
"; - - } - - $view.="
"; - - // 2 - - echo $view; - echo "
"; - $view2=''; - $view2.="
"; - - - $view2.="
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ".$order['order_id']."
: ".date('Y-m-d H:i:s',$order['mktime'])."
: ".$order['name']."
: ".$order['phone']."
: ".$order['city']."
: ".$order['warehouse']."
: ".$order['insurance']."
: ".$order['mcomment']."
-
-
"; - - echo $view2; - - - } - } -?> diff --git a/account/admin/orders_.php b/account/admin/orders_.php deleted file mode 100644 index 0ab622c..0000000 --- a/account/admin/orders_.php +++ /dev/null @@ -1,1699 +0,0 @@ -0) { - - // - $sql2=sprintf("UPDATE catalogs_orders SET city=%s,adress=%s,comment=%s,mcomment=%s,total=%s WHERE id='".$_POST['order_id']."'", - GetSQLValueString($_POST['user']['city'], "text"), - GetSQLValueString($_POST['user']['address'], "text"), - GetSQLValueString($_POST['user']['comment'], "text"), - GetSQLValueString($_POST['user']['mcomment'], "text"), - GetSQLValueString($summary, "text")); - $result2 = mysql_query($sql2) or die(mysql_error()); - - eMailing('xml',$_POST['user_id'], $_POST['order_id']); - - } else { - - $sql2="DELETE FROM catalogs_orders WHERE id='".$_POST['order_id']."'"; - $result2 = mysql_query($sql2) or die(mysql_error()); - } - - GoBack(1); - - } else { - - echo""; - - } - - } - - // ============== - // ==== add ===== - // ============== - - if (isset($_POST['send']) && $_POST['send']=='add-order') { - - // - $debil==false; - - for($i=1; $i<=count($_POST['item']); $i++) { - if(isset($_POST['item']['mod_id'][$i]) && $_POST['item']['mod_id'][$i]=='') { $debil=true; } - } - - if( $debil==false) { - - // $error=''; - // $error[] = ValidFormData($_POST['user']['email'],'email','email'); - // $error[] = ValidFormData($_POST['user']['city'],'','require'); - // $error[] = ValidFormData($_POST['user']['address'],'','require'); - // $error[] = ValidFormData($_POST['user']['tel'],'.','mobile'); - // $error[] = ValidFormData($_POST['user']['username'],'','require'); - - // $alert=implode('\r\n',$error); - - // $mass=array_filter($error); - // if (empty($mass)) { - - // - // $sql="SELECT * FROM zlo_users WHERE email='".$_POST['user']['email']."' "; - // $result = mysql_query($sql) or die(mysql_error()); - // if (mysql_affected_rows()!=0) { - - // } - - $time=mktime(); - $date=date('Y-m-d H:i:s',$time); - - // - if($_POST['user']['user_id']=='' || $_POST['user']['user_id']==0 || $_POST['user']['user_id']=='0') { - - if (strpos($_POST['user']['email'],"@user.com")) { - $_POST['user']['group']=1; - } else { - $_POST['user']['group']=2; - } - - // - $pass=generate_password(6); - $sql = sprintf("INSERT INTO zlo_users (pass, email, city, address, tel, registered, username, tel2, `group`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)", - GetSQLValueString($pass, "text"), - GetSQLValueString($_POST['user']['email'], "text"), - GetSQLValueString($_POST['user']['city'], "text"), - GetSQLValueString($_POST['user']['address'], "text"), - GetSQLValueString($_POST['user']['tel'], "text"), - GetSQLValueString($date, "text"), - GetSQLValueString($_POST['user']['username'], "text"), - GetSQLValueString($_POST['user']['tel2'], "text"), - GetSQLValueString($_POST['user']['group'], "int")); - $result = mysql_query($sql) or die(mysql_error()); - - // ID - $sql="SELECT id FROM zlo_users WHERE registered='$date' AND tel='".$_POST['user']['tel']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $user=mysql_fetch_assoc($result); - - // - if($user['group']!=1) { - eMailing('reg',$user['id']); - } - - $_POST['user']['user_id']=$user['id']; - - } else { echo " ";} - - } - - // - $sql=sprintf("INSERT INTO catalogs_orders (user_id,name,email,city,adress,phone,phonemob,comment,mktime,total,status) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,1)", - GetSQLValueString($_POST['user']['user_id'], "text"), - GetSQLValueString($_POST['user']['username'], "text"), - GetSQLValueString($_POST['user']['email'], "text"), - GetSQLValueString($_POST['user']['city'], "text"), - GetSQLValueString($_POST['user']['address'], "text"), - GetSQLValueString($_POST['user']['tel'], "text"), - GetSQLValueString($_POST['user']['tel2'], "text"), - GetSQLValueString($_POST['user']['comment'], "text"), - GetSQLValueString($time, "text"), - GetSQLValueString($_POST['summary'], "text")); - $result = mysql_query($sql) or die(mysql_error()); - - // - $sql="SELECT id FROM catalogs_orders WHERE mktime='$time' AND user_id='".$_POST['user']['user_id']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $order=mysql_fetch_assoc($result); - } else { echo "";} - - - // - for($i=0; $i<=count($_POST['item']); $i++) { - if($_POST['item']['code'][$i]!=''){ - $sql=sprintf("INSERT INTO catalogs_orders_products (order_id,product_id,product_cine_id,count) VALUES (%s,%s,%s,%s)", - GetSQLValueString($order['id'], "text"), - GetSQLValueString($_POST['item']['mod_id'][$i], "text"), - GetSQLValueString($_POST['item']['price'][$i], "text"), - GetSQLValueString($_POST['item']['quant'][$i], "text")); - $result = mysql_query($sql) or die(mysql_error()); - } - } - - // - if ($user['group']!=1) { - eMailing('order-new',$_POST['user']['user_id'], $order['id']); - } - - echo ""; - - // } else { - - // echo""; - - // } - - - } else { - - echo""; - - } - - } - - // ================= - // ==== NOTIFY ===== - // ================= - - // ============== - // == changed === - // ============== - - if (isset($_GET['notify']) && $_GET['notify']=='order-changed') { - - eMailing('order-changed',$_GET['user'], $_GET['order']); - - echo ""; - } - - - // ====================================== - // ====================================== - // ============== ================= - // ====================================== - // ====================================== - - - // ============= - // ==== all ==== - // ============= - - if (!isset($_GET['action'])) { - - echo""; - - // ***** ***** - if(isset($_SESSION['admin']['edit'])) { - echo""; - } - // *********************** - - // ============== - // === report === - // ============== - - - $time=''; - $time['day'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), date('j'), date('Y')); - if(date('w')==1) { - $time['week'] = " o.`mktime` >=".mktime(0, 0, 0, date('n'), date('j'), date('Y'))." "; - } else { - $time['week'] = "( o.`mktime` BETWEEN ".strtotime("last Monday")." AND ".mktime(0, 0, 0, date('n'), date('j')+1, date('Y')).") "; - } - $time['month'] = "o.`mktime` >= ".mktime(0, 0, 0, date('n'), 1, date('Y')); - - Report::put_time($time); - Report::make(); - - echo"
"; - - // === === - - echo"
"; - - echo" : "; - echo Report::html_report(Report::get_mass_client()); - echo"
"; - - echo"
"; - - // === === - - echo"
"; - - echo" : "; - echo Report::html_report(Report::get_mass_order()); - echo"
"; - - echo"
"; - - // === === - - echo"
"; - - echo": "; - echo""; - - // - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - echo"
"; - - echo"
"; - - echo"
"; - - - if (!isset($_GET['status'])) {$_GET['status']=1;} - if(isset($_GET['user'])) {$AND="AND u.id=".$_GET['user'];} else {$AND='';} - - // ============= - // === === - // ============= - - $th=array("id"=>" ","username"=>"", "email"=>"email", "tel"=>"", "code"=>""); - - // - if (isset($_REQUEST['search'])) { - if($_REQUEST['field']=='id') {$pre="o";} - if($_REQUEST['field']=='username') {$pre="u";} - if($_REQUEST['field']=='email') {$pre="u";} - if($_REQUEST['field']=='tel') {$pre="u";} - if($_REQUEST['field']=='code') {$pre="m";} - $AND=''; - if (trim($_REQUEST['look'])!='') { - $AND.="AND $pre.`".$_REQUEST['field']."` LIKE '%".trim($_REQUEST['look'])."%'"; - } - if ( ($_REQUEST['form']['date_start'] !='') && ($_REQUEST['form']['date_end'] !='')){ - - $dateStart =$_REQUEST['form']['date_start']; - $dateEnd =$_REQUEST['form']['date_end']; - - $mkdate=ExtractDate($_REQUEST['form']['date_start']); - $_REQUEST['form']['date_start'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); - - $mkdate=ExtractDate($_REQUEST['form']['date_end']); - $_REQUEST['form']['date_end'] = mktime(0, 0, 0, $mkdate[1], $mkdate[2], $mkdate[0]); - - $AND.=" AND (o.`mktime` BETWEEN '".$_REQUEST['form']['date_start']."' AND '".$_REQUEST['form']['date_end']."') "; - } - } - // ============= - // === ==== - // ============= - - echo""; - - - // =========== =========== - -$eshka = ""; -$eshka2 = ""; -$eshka3 = ""; -$lll = ""; -if(trim(@$_REQUEST['da'])=='1'){ - $eshka = "o.mktime<'1341090000' AND "; - $eshka2 = "o.mktime<'1341090000' AND "; - $lll = "font-weight:bold;"; -}else{ - $eshka = "o.mktime>'1341090000' AND "; - $eshka2 = "o.mktime>'1341090000' AND "; - $lll = ""; -} - - - -if(trim(@$_REQUEST['pr'])=='1'){ -$tim = (time()-86400); - $eshka3 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; -}else{ -$eshka3 = ""; -} - -if(trim(@$_REQUEST['prs'])=='1'){ -$tim = (time()-172800); - $eshka4 = "o.upd<'".date("Y-m-d H:i:s",$tim)."' AND "; -}else{ -$eshka4 = ""; -} - - - $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, o.`mktime` as order_date, u.group, o.id as order_id, m.*, m.product_id as mod_id, op.* , p.*, g.color as group_color - FROM catalogs_orders as o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - LEFT JOIN zlo_users as u ON u.id=o.user_id - LEFT JOIN zlo_users_group as g ON g.id=u.group - WHERE ".$eshka3.$eshka4.$eshka."o.status='".$_GET['status']."' $AND GROUP BY o.id ORDER BY o.mktime DESC "; - $pager['sql']= $sql; - $pager=pagerGetRun($pager,10,15); - // echo$pager['sql']; - $result = mysql_query($pager['sql']) or die(mysql_error()); - if (mysql_affected_rows()!=90800) { - - - // ============= - // === ==== - // ============= - - echo"
"; - echo"
"; - //////$eshka2.$eshka - $sql0 = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; - $result0 = mysql_query($sql0) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($rows=mysql_fetch_assoc($result0)) { - - //$AND - - // - $sql2 = "SELECT count(o.id) AS calc, o . * , m.*, m.product_id as mod_id, op.* , p.* - FROM catalogs_orders as o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - LEFT JOIN zlo_users as u ON u.id=o.user_id - LEFT JOIN zlo_users_group as g ON g.id=u.group - WHERE ".$eshka2."o.status='".$rows['id']."' $AND"; - - -//if(trim($_REQUEST['test'])=="1") echo $sql2; - - - - $sql2 = "SELECT count(o.id) AS calc FROM catalogs_orders as o WHERE ".$eshka2."o.status='".$rows['id']."'"; - - - $result2 = mysql_query($sql2) or die(mysql_error()); - $row2=mysql_fetch_assoc($result2); - $yyyyyy = str_replace("prs=1","prs=0",str_replace("pr=1","pr=0",urlQueryChange2('status',$rows['id']))); - echo"
".$rows['title']."(".$row2['calc'].")
"; - } - } - - - - -$tim = (time()-86400); - $sql3 = " - SELECT count(*) count FROM catalogs_orders WHERE `status`=1 AND `upd`<'".date("Y-m-d H:i:s",$tim)."';"; - $result3 = mysql_query($sql3) or die(mysql_error()); - $row3=mysql_fetch_assoc($result3); -$yyyyyt = ""; -if(trim($_REQUEST['pr'])=="1") $yyyyyt = "font-weight:bold; "; - -$tim2 = (time()-172800); - $sql4 = " - SELECT count(*) count FROM catalogs_orders WHERE `status`=2 AND `upd`<'".date("Y-m-d H:i:s",$tim2)."';"; - $result4 = mysql_query($sql4) or die(mysql_error()); - $row4=mysql_fetch_assoc($result4); -$yyyyyt2 = ""; -if(trim($_REQUEST['prs'])=="1") $yyyyyt2 = "font-weight:bold; "; - - - echo" - -
-
- -
-
-
-
- . (".$row3['count'].") -
- -
- . (".$row4['count'].") -
-
-
 
- "; - - // =================== - // === === - // =================== - - while ($order=mysql_fetch_assoc($result)) { - - echo"
"; - - echo"
- -
-

#".$order['order_id']."
- : ".date('Y-m-d H:i:s',$order['order_date'])." -

-
- - - - - - -
".$order['tel']." 
- - -
".$order['tel2']." 
- - -
".viewBook('zlo_users_group', $order['group'], 'id', 'name')." 
- -
- [ ] - -
- -
- - - -
".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." 
- - -
".$order['city']." 
- - -
".$order['address']." 
- - -
".$order['comment']." 
- -
- -
-
-
-
"; - - - // - - echo" -
-
- "; - echo" - - - - - - - - - - - - - "; - - $sql3 = " - SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* - FROM catalogs_orders AS o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - WHERE o.id='".$order['order_id']."'"; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($item=mysql_fetch_assoc($result3)) { { $i++; - - - // - $sql5 = "SELECT c.name as city, o.count - FROM catalogs_keys_products_cities as o - LEFT JOIN catalogs_cities as c - ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStockDesc=''; } - - echo" - - - - - - - - - - - - "; - - } - - } - } - - echo"
.
$i .".$item['code']."".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."".$item['name']."".$item['size']."".$item['color']."".$item['count']."".$item['cine']."".($item['cine']*$item['count'])."".$onStockDesc."
- : ".$order['total']." . -
"; - - - - echo"
"; - - // ***** ***** - if(isset($_SESSION['admin']['edit'])) { - - // - if ($order['status']!=6) { - echo "
-
-
- - "; - } - echo" -
-
-
-
-
-
"; - } - - } - echo"
"; - - - } - - echo"
"; - - - - // === Pager - - echo"
- ".pagerGetShow($pager)." -
"; - - } - - } - - // =============== - // ===== show ==== - // =============== - - if (isset($_GET['action']) && $_GET['action']=='show') { - - // - - echo"
"; - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($row=mysql_fetch_assoc($result)) { - - // - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; - $result2 = mysql_query($sql2) or die(mysql_error()); - $row2=mysql_fetch_assoc($result2); - - echo"
".$row['title']."(".$row2['calc'].")
"; - } - } - echo"
-
- "; - - if(!isset($_GET['status'])) {$_GET['status']=1;} - - // =========== =========== - - $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, u.group, o.id as order_id - FROM catalogs_orders as o - LEFT JOIN zlo_users as u on u.id=o.user_id - WHERE u.id=".$_GET['user']." AND o.status=".$_GET['status']." ORDER BY mktime DESC "; - $pager['sql']= $sql; - $pager=pagerGetRun($pager,10,15); //echo$pager['sql']; - $result = mysql_query($pager['sql']) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - - // =================== - // === === - // =================== - - while ($order=mysql_fetch_assoc($result)) { - - echo"
"; - - echo"
- -
-

#".$order['order_id']."
- : ".date('Y-m-d H:i:s',$order['mktime'])." -

-
- - - - - - -
".$order['tel']." 
- - -
".$order['tel2']." 
- - -
".viewBook('zlo_users_group', $order['group'], 'id', 'name')." 
- -
- [ ] - -
- -
- - - -
".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')." 
- - -
".$order['city']." 
- - -
".$order['address']." 
- - -
".$order['comment']." 
- -
- -
-
-
-
"; - - - // - - echo" -
-
- "; - echo" - - - - - - - - - - - - - "; - - $sql3 = " - SELECT o . * , m.*, m.product_id as mod_id, op.* , p.* - FROM catalogs_orders AS o - LEFT JOIN catalogs_orders_products as op ON op.order_id=o.id - LEFT JOIN catalogs_modifications AS m ON m.id = op.product_id - LEFT JOIN catalogs_products AS p ON p.id = m.product_id - WHERE o.id='".$order['order_id']."'"; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($item=mysql_fetch_assoc($result3)) { { $i++; - - - // - $sql5 = "SELECT c.name as city, o.count - FROM catalogs_keys_products_cities as o - LEFT JOIN catalogs_cities as c - ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStockDesc=''; } - - echo" - - - - - - - - - - - - "; - - } - - } - } - - echo"
.
$i .".$item['code']."".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."".$item['name']."".$item['size']."".$item['color']."".$item['count']."".$item['cine']."".($item['cine']*$item['count'])."".$onStockDesc."
- : ".$order['total']." . -
"; - - - - echo"
"; - - } - - // === Pager - - echo"
- ".pagerGetShow($pager)." -
"; - } - } - - // =============== - // ===== edit ==== - // =============== - - if (isset($_GET['action']) && $_GET['action']=='edit') { - - // - - if (!isset($_GET['status'])) {$status=1;} else {$status=$_GET['status'];} - - echo"
"; - $sql = "SELECT * FROM zlo_book_status WHERE id IN (1,2,4,5)"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($row=mysql_fetch_assoc($result)) { - - // - $sql2 = "SELECT count(`id`) AS calc FROM catalogs_orders WHERE status='".$row['id']."' AND user_id=".$_GET['user'].""; - $result2 = mysql_query($sql2) or die(mysql_error()); - $row2=mysql_fetch_assoc($result2); - - echo"
".$row['title']."(".$row2['calc'].")
"; - } - } - echo"
-
- "; - - - // =========== =========== - - $sql = "SELECT o.*, o.name as username, o.adress as address, o.phone as tel, o.phonemob as tel2, u.group, o.id as order_id, o.adress as address, g.color - FROM catalogs_orders as o - LEFT JOIN zlo_users as u ON u.id=o.user_id - LEFT JOIN zlo_users_group as g ON g.id=u.group - WHERE o.id='".$_GET['order']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - - $order=mysql_fetch_assoc($result); - - echo"
"; - echo"
"; - - echo" -
-
- #".$order['order_id']." C: ".$order['total']." . - - -
".date('Y-m-d H:i:s')."
- - -
-   - -
- - -
-   - -
- - -
-   - -
- - -
-   - -
- - "; - echo " -
- -
"; - - echo " - -
 
- - -
 
- - -
- - -
- - "; - - echo" -
-
-
"; - - // - - $sql3 = "SELECT * FROM catalogs_orders_products - WHERE `order_id`='".$order['order_id']."' "; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { $i=0; - echo" -
- -
-
-
-
-
-
-
-
.
-
-
-
-
-
-
-
- -
-
-
1
-
- - -
-
-
- -
-
 
-
 
-
 
-
 
-
-
0
-
0
-
- - - - - - - -
- - -
- -
-
-
- "; - - while ($item_id=mysql_fetch_assoc($result3)) { $i++; - - // - $sql4 = "SELECT m.*, m.id as mod_id, p.* from catalogs_modifications as m - LEFT JOIN catalogs_products as p - ON p.id=m.product_id - WHERE m.id='".$item_id['product_id']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $item=mysql_fetch_assoc($result4); - - // - $sql5 = "SELECT c.name as city, o.count - FROM catalogs_keys_products_cities as o - LEFT JOIN catalogs_cities as c - ON o.city_id=c.id - WHERE o.mod_code='".$item['code']."' AND o.count>0 "; - $result5 = mysql_query($sql5) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $onStockDesc=''; - while ($onStock=mysql_fetch_assoc($result5)) { - $onStockDesc.=$onStock['city']."(".$onStock['count'].") "; - } - } else { $onStock='';} - - echo"
-
-
$i
-
- - -
-
-
- -
-
".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')." 
-
".$item['name']." 
-
".$item['size']." 
-
".$item['color']." 
-
-
".$item['cine']."
-
".($item['cine']*$item_id['count'])."
-
$onStockDesc
- - - - - - - -
- - -
- -
-
-
"; - } - - } - - echo"
- -
- : 0 0 . -
- - - - - - - - "; - - echo"
"; - - // XML - $dateFromDate=ExtractDate((date('Y-m-d H:i:s',$order['mktime']))); - - // - if ($order['status']!=6) { - echo "
-
- - "; - echo" - "; - } - - - echo""; - - echo" -
-
-
"; - - if (is_file($_SERVER['DOCUMENT_ROOT']."/xml/".$dateFromDate[0]."/".$dateFromDate[1]."/order_".$order['order_id'].".xml")) { - echo"
"; - } - - - echo"
"; - } - echo"
"; - - echo""; - - } - - } else { echo"

";} - - // ===================== - // ===== javascript ==== - // ===================== - - echo" - - - "; - - echo" - - - - - - - - - "; - } - - - - - // ============= - // ==== add ==== - // ============= - - if (isset($_GET['action']) && $_GET['action']=='add') { - - if (isset($_POST['user'])) {} - - $user=array(); - - if(isset($_GET['user'])) { - - $sql = "SELECT * FROM zlo_users WHERE id='".$_GET['user']."'"; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $user=mysql_fetch_assoc($result); - } - - } else { - - if(isset($_POST)) {$user=$_POST['user'];} - - } - - - - echo"
"; - echo"
"; - echo"
"; - - echo" -
-
- - - -
".date('Y-m-d H:i:s')."
"; - - if(!isset($_GET['user'])) { - echo"
"; - } - - if(isset($_GET['user'])) { - - $readonly='readonly="readonly"'; - $disabled='disabled="disabled"'; - - } else {$readonly='';$disabled='';} - - echo" - -
 
- -
-
-
- - - -
 
- -
-
-
- - - - -
 
- - -
 
- - "; - echo " -
- -
"; - - echo " - -
 
- - -
 
- - -
"; - - // - echo" - "; - - echo ""; - - // hidden - if (isset($_GET['user'])) { - echo""; - } - - echo""; - - echo"
-
-
-
"; - - echo" -
- -
-
-
-
-
-
-
-
.
-
-
-
-
-
-
-
- -
-
-
1
-
- - -
-
-
- -
-
 
-
 
-
 
-
 
-
-
0
-
0
-
- - - - - - - -
- - -
- -
-
-
- -
-
-
1
-
- - -
-
-
- -
-
 
-
 
-
 
-
 
-
-
0
-
0
-
- - - - - - - -
- - -
- -
-
-
-
- -
- : 0 0 . -
- - - - - -
-
- "; - - // ===================== - // ===== javascript ==== - // ===================== - - echo" - - - "; - - echo" - - - - - - - - - "; - - } - - - // ============= - // === print === - // ============= - - if (isset($_GET['action']) && $_GET['action']=='print') { - - // =========== =========== - - if (!isset($_GET['status'])) {$_GET['status']=1;} - - $sql = "SELECT o.*,u.*, o.id as order_id FROM catalogs_orders as o - RIGHT JOIN zlo_users as u on u.id=o.user_id - WHERE o.id='".$_GET['order_id']."' "; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - $view=''; - $view.="
"; - - $order=mysql_fetch_assoc($result); - - $view.="
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ".$order['order_id']."
: ".date('Y-m-d H:i:s',$order['mktime'])."
: ".$order['username']."
: ".$order['tel']."
. : ".$order['tel2']."
: ".viewBook('zlo_book_delivery', $order['delivery'], 'id', 'title')."
: ".$order['city']."
: ".$order['address']."
: ".$order['comment']."
-
"; - - - // - - $sql3 = "SELECT * FROM catalogs_orders_products - WHERE `order_id`='".$order['order_id']."' "; - $result3 = mysql_query($sql3) or die(mysql_error()); - if (mysql_affected_rows()!=0) { $i=0; - - $view.="
"; - - - while ($item_id=mysql_fetch_assoc($result3)) { $i++; - - $sql4 = "SELECT * FROM catalogs_modifications as m - LEFT JOIN catalogs_products as p - ON p.id=m.product_id - WHERE m.id='".$item_id['product_id']."' "; - $result4 = mysql_query($sql4) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - while ($item=mysql_fetch_assoc($result4)) { - - $view.=" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$i .
".$item['code']."
".viewBook('catalogs_brends', $item['brend_id'], 'id', 'name')."
".$item['name']."
".$item['size']."
".$item['color']."
.".$item_id['count']."
".$item['cine']."
".($item['cine']*$item_id['count'])."
"; - - } - - } - } - - $view.=" : ".$order['total']." . - -
"; - - } - - $view.="
"; - - // 2 - - echo $view; - echo "
"; - echo $view; - - - } - } -?> diff --git a/account/func/func.php b/account/func/func.php index f77ba68..0e38951 100644 --- a/account/func/func.php +++ b/account/func/func.php @@ -1,569 +1,646 @@ -","",$content); -$content = str_replace("<","",$content); -$content = str_replace("/","",$content); -$content = str_replace("'","",$content); -$content = str_replace('"',"",$content); -$content = str_replace(":","",$content); -list($a,$b)=spliti("b-region__time",$content,2); -list($times,$b)=spliti("!",$b,2); -$times = preg_replace("/[^0-9]+/","",$times); - -$times1 = substr($times,2,2); -$times2 = substr($times,0,2); -$times = strtotime(date("d-m-Y")." ".$times2.":".$times1.":00"); -*/ - -$times = time(); - - - -//$start_time = date("Y-m-d H:i:s",$times+360); -//$end_time = date("Y-m-d H:i:s", $times+360); // 3 - -$start_time = 'AUTO'; -$end_time = 'AUTO'; - -//echo $start_time."(".date("Y-m-d H:i:s").")"."=>".$end_time; -$rate = 120; -$livetime = 4; -$source = 'extremstyle'; // Alfaname -$recipient = $tel; -$user = '380674064008'; -$password = 'smsartweb2012'; - -$myXML = "\n"; -$myXML .= ""; -$myXML .= "SENDSMS"; -$myXML .= ' '."\n"; -$myXML .= " ".$text.""; -$myXML .= " ".$recipient.""; -$myXML .= ""; -$myXML .= ""; - -$ch = curl_init(); -curl_setopt($ch, CURLOPT_USERPWD , $user.':'.$password); -curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); -curl_setopt($ch, CURLOPT_POST, 1); -curl_setopt($ch, CURLOPT_URL, 'http://sms-fly.com/api/api.php'); -curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml", "Accept: text/xml")); -curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); -curl_setopt($ch, CURLOPT_POSTFIELDS, $myXML); -$response = curl_exec($ch); -curl_close($ch); - -//echo $response; -//exit; +\n"; + $myXML .= ""; + $myXML .= "SENDSMS"; + $myXML .= ' ' . "\n"; + $myXML .= " " . $text . ""; + $myXML .= " " . $recipient . ""; + $myXML .= ""; + $myXML .= ""; + + $ch = curl_init (); + curl_setopt ($ch, CURLOPT_USERPWD, $user . ':' . $password); + curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt ($ch, CURLOPT_POST, 1); + curl_setopt ($ch, CURLOPT_URL, 'http://sms-fly.com/api/api.php'); + curl_setopt ($ch, CURLOPT_HTTPHEADER, array ( + "Content-Type: text/xml", + "Accept: text/xml" + )); + curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt ($ch, CURLOPT_POSTFIELDS, $myXML); + $response = curl_exec ($ch); + curl_close ($ch); + + // echo $response; + // exit; } - -function ValidFormData($data,$titles,$type){ - - switch($type) { - - case 'only_digits': - - $error = " $titles, ."; - - if(strlen($data)>0){ - if(preg_match("/[0-9]+/i",$data)) {$error='';} - } - return $error; - break; - - case 'mobile': - - $error = " $titles (: +380XXXXXXXXX)."; - - if(strlen($data)>0){ - // if(preg_match("/^(\+)[0-9]+$/i",$data.$names)) {$error='';} - } - // return $error; - break; - - case 'require': - - $error = " $titles ."; +function ValidFormData ($data, $titles, $type) +{ + switch ($type) + { + case 'only_digits' : + + $error = " $titles, ."; + + if (strlen ($data) > 0) + { + if (preg_match ("/[0-9]+/i", $data)) + { + $error = ''; + } + } + return $error; + break; - if(strlen($data)>0){ - if(preg_match("/.{1,100}/i",$data.$names)) {$error='';} - } - return $error; - break; + case 'mobile' : + + $error = " $titles (: +380XXXXXXXXX)."; + + if (strlen ($data) > 0) + { + // if(preg_match("/^(\+)[0-9]+$/i",$data.$names)) {$error='';} + } + // return $error; + break; - case 'email': - - // email - $error = " $titles. "; - - if(strlen($data)>0) { + case 'require' : - if(preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $data)) { - - $error=''; - + $error = " $titles ."; + + if (strlen ($data) > 0) + { + if (preg_match ("/.{1,100}/i", $data . $names)) + { + $error = ''; + } } - } - return $error; - break; + return $error; + break; - default: - - return $error = " $type"; - break; + case 'email' : + + // email + $error = " $titles. "; + + if (strlen ($data) > 0) + { + + if (preg_match ("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $data)) + { + + $error = ''; + } + } + return $error; + break; - return $error; - - } + default : + + return $error = " $type"; + break; + + return $error; + } } - -function FreandlyDigits($what) { - - $total=strlen($what); - $mass=''; $result=''; $j=0; +function FreandlyDigits ($what) +{ + $total = strlen ($what); + $mass = ''; + $result = ''; + $j = 0; - for($i=$total;$i>=0;$i--){ - $mass[]=substr($what,$i,1); - if ($i!=0) { - if ($j==3) {$mass[]=' '; $j=0;} - $j++; + for ($i = $total; $i >= 0; $i --) + { + $mass[] = substr ($what, $i, 1); + if ($i != 0) + { + if ($j == 3) + { + $mass[] = ' '; + $j = 0; + } + $j ++; } } - krsort($mass); + krsort ($mass); - foreach($mass as $digit){$i++; $j++; - $result.=$digit; + foreach ($mass as $digit) + { + $i ++; + $j ++; + $result .= $digit; } return $result; } -function ExtractDate($date){ //2011-02-03 10:45:20 - - if (strpos(trim($date)," ")) { - - list($Date,$Time)=explode(" ",trim($date)); - $result1=explode("-",trim($Date)); - $result2=explode(":",trim($Time)); - - foreach ($result2 as $key=>$value) { - $result1[]=$value; +function ExtractDate ($date) +{ // 2011-02-03 10:45:20 + if (strpos (trim ($date), " ")) + { + + list ($Date, $Time) = explode (" ", trim ($date)); + $result1 = explode ("-", trim ($Date)); + $result2 = explode (":", trim ($Time)); + + foreach ($result2 as $key => $value) + { + $result1[] = $value; } - + return $result1; + } + elseif (strpos (trim ($date), "-")) + { - } elseif (strpos(trim($date),"-")) { - - return $result=explode("-",trim($date)); - - } elseif (strpos(trim($date),":")) { - - return $result=explode(":",trim($date)); + return $result = explode ("-", trim ($date)); + } + elseif (strpos (trim ($date), ":")) + { + + return $result = explode (":", trim ($date)); } - } -function AddZeroDate ($i) { - - if($i=='') {$i= "00"; } - if($i<10) {$i= "0".$i; } +function AddZeroDate ($i) +{ + if ($i == '') + { + $i = "00"; + } + if ($i < 10) + { + $i = "0" . $i; + } return $i; } -function WhatMonth ($i) { - - $month1['1']=""; - $month1['2']=""; - $month1['3']=""; - $month1['4']=""; - $month1['5']=""; - $month1['6']=""; - $month1['7']=""; - $month1['8']=""; - $month1['9']=""; - $month1['10']=""; - $month1['11']=""; - $month1['12']=""; - - $month2['1']=""; - $month2['2']=""; - $month2['3']=""; - $month2['4']=""; - $month2['5']=""; - $month2['6']=""; - $month2['7']=""; - $month2['8']=""; - $month2['9']=""; - $month2['10']=""; - $month2['11']=""; - $month2['12']=""; +function WhatMonth ($i) +{ + $month1['1'] = ""; + $month1['2'] = ""; + $month1['3'] = ""; + $month1['4'] = ""; + $month1['5'] = ""; + $month1['6'] = ""; + $month1['7'] = ""; + $month1['8'] = ""; + $month1['9'] = ""; + $month1['10'] = ""; + $month1['11'] = ""; + $month1['12'] = ""; - return $month2[$i]; + $month2['1'] = ""; + $month2['2'] = ""; + $month2['3'] = ""; + $month2['4'] = ""; + $month2['5'] = ""; + $month2['6'] = ""; + $month2['7'] = ""; + $month2['8'] = ""; + $month2['9'] = ""; + $month2['10'] = ""; + $month2['11'] = ""; + $month2['12'] = ""; + return $month2[$i]; } -function GetFormUrl() { +function GetFormUrl () +{ $link = $_SERVER['REQUEST_URI']; - if (!isset($_SERVER['QUERY_STRING'])) { - $link.= "?".htmlentities($_SERVER['QUERY_STRING']); + if (! isset ($_SERVER['QUERY_STRING'])) + { + $link .= "?" . htmlentities ($_SERVER['QUERY_STRING']); } return $link; } -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; +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; } -function generate_password($number) { - +function generate_password ($number) +{ $arr = array('a','b','c','d','e','f', - 'g','h','i','j','k','l', - 'm','n','o','p','r','s', - 't','u','v','x','y','z', - 'A','B','C','D','E','F', - 'G','H','I','J','K','L', - 'M','N','O','P','R','S', - 'T','U','V','X','Y','Z', - '1','2','3','4','5','6', - '7','8','9','0'); + 'g','h','i','j','k','l', + 'm','n','o','p','r','s', + 't','u','v','x','y','z', + 'A','B','C','D','E','F', + 'G','H','I','J','K','L', + 'M','N','O','P','R','S', + 'T','U','V','X','Y','Z', + '1','2','3','4','5','6', + '7','8','9','0'); // $pass = ""; - for($i = 0; $i < $number; $i++) { - // - $index = rand(0, count($arr) - 1); - $pass .= $arr[$index]; + for ($i = 0; $i < $number; $i++) + { + // + $index = rand(0, count($arr) - 1); + $pass .= $arr[$index]; } - return $pass; -} - - -// ========================= Pager GET ============================= - -function pagerGetRun($pager, $PerPage='', $Size=''){ - - - global $url; - if ($PerPage!='') {$pager['PerPage']=$PerPage;} - if ($Size!='') {$pager['Size']=$Size;} - - $result=mysql_query($pager['sql']) or die (mysql_error()); - $pager['TotalRows']=mysql_affected_rows(); - $pager['All10']=ceil($pager['TotalRows']/($pager['PerPage']*$pager['Size'])); # . 10 . *** - $pager['AllPages']=ceil($pager['TotalRows']/$pager['PerPage']); # . *** - $pager['ActivePage']=1; # *** - if (isset($_GET['page'])) { $pager['ActivePage']=$_GET['page'];} - $pager['Active10']=ceil($pager['ActivePage']/$pager['Size']); - - $pager['sql'].=" LIMIT ".($pager['ActivePage']-1)*$pager['PerPage'].", ".$pager['PerPage']; - return $pager; - + return $pass; } -function pagerGetShow($pager) { - - if ($pager['AllPages']!=1) { - - echo '
'; - - // ======= - - if ($pager['ActivePage']>$pager['Size']) { - // - echo " "; - echo "".(($pager['Active10']-2)*$pager['Size'])."...".(($pager['Active10']-1)*$pager['Size'])." "; - - // - } else { - echo " "; +// =============== +// ==== Pager ==== +// =============== - } +function pagerGetRun ($pager, $PerPage = '', $Size = '') +{ + global $url; + if ($PerPage != '') + { + $pager['PerPage'] = $PerPage; + } + if ($Size != '') + { + $pager['Size'] = $Size; + } - // ======= - - // - - if ($pager['All10']>$pager['Active10']) { - - for ($i=($pager['Active10']-1)*$pager['Size']+1; $i<=$pager['Active10']*$pager['Size']; $i++) - - if ($i==$pager['ActivePage']) { - echo "".$i." "; - } else { - echo "".$i." "; - } - - // - - } else { - - for ($i=($pager['Active10']-1)*$pager['Size']+1; $i<=$pager['AllPages']; $i++) - - if ($i==$pager['ActivePage']) { - echo "".$i." "; - } else { - echo "".$i." "; - } - } - - // ======= - - // 50...60 - if ((($pager['All10']-$pager['Active10'])>=1) && ($pager['All10']!=$pager['Active10']+1)) { - echo "".($pager['Active10']*$pager['Size']+1)."...".(($pager['Active10']+1)*$pager['Size'])." "; - echo ""; - } - // 50...58 - if ((($pager['All10']-$pager['Active10'])>=1) && ($pager['All10']==$pager['Active10']+1)) { - echo "".($pager['Active10']*$pager['Size']+1)."...".$pager['AllPages']." "; - echo ""; - } - - if ($pager['Active10']==$pager['All10']) { echo ""; } - - - echo '
'; - } - -} - - -function urlQueryChange ($what, $for) { - - $url=$_SERVER['REQUEST_URI']; + $result = mysql_query ($pager['sql']) or die (mysql_error ()); + $pager['TotalRows'] = mysql_affected_rows (); + $pager['All10'] = ceil ($pager['TotalRows'] / ($pager['PerPage'] * $pager['Size'])); // . 10 . *** + $pager['AllPages'] = ceil ($pager['TotalRows'] / $pager['PerPage']); // . *** + $pager['ActivePage'] = 1; // *** - if (!isset($_SERVER['QUERY_STRING']) || isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']=='') { + if (isset ($_GET['page'])) + { + $pager['ActivePage'] = $_GET['page']; + } - $url.="?".$what."=1"; + $pager['Active10'] = ceil ($pager['ActivePage'] / $pager['Size']); - } else { - - if (!isset($_GET['page']) or $_GET['page']==1) {$url.="&".$what."=1";} + $pager['sql'] .= " LIMIT " . ($pager['ActivePage'] - 1) * $pager['PerPage'] . ", " . $pager['PerPage']; + return $pager; +} +function pagerGetShow ($pager) +{ + if ($pager['AllPages'] != 1) + { + + echo '
'; + + // ==== ==== + + if ($pager['ActivePage'] > $pager['Size']) + { + // + echo " "; + echo "" . (($pager['Active10'] - 2) * $pager['Size']) . "..." . (($pager['Active10'] - 1) * $pager['Size']) . " "; + + // + } + else + { + echo " "; + } + + // ==== ==== + + // + + if ($pager['All10'] > $pager['Active10']) + { + + for ($i = ($pager['Active10'] - 1) * $pager['Size'] + 1; $i <= $pager['Active10'] * $pager['Size']; $i ++) + + if ($i == $pager['ActivePage']) + { + echo "" . $i . " "; + } + else + { + echo "" . $i . " "; + } + + // + } + else + { + + for ($i = ($pager['Active10'] - 1) * $pager['Size'] + 1; $i <= $pager['AllPages']; $i ++) + + if ($i == $pager['ActivePage']) + { + echo "" . $i . " "; + } + else + { + echo "" . $i . " "; + } + } + + // ==== ==== + + // 50...60 + if ((($pager['All10'] - $pager['Active10']) >= 1) && ($pager['All10'] != $pager['Active10'] + 1)) + { + echo "" . ($pager['Active10'] * $pager['Size'] + 1) . "..." . (($pager['Active10'] + 1) * $pager['Size']) . " "; + echo ""; + } + // 50...58 + if ((($pager['All10'] - $pager['Active10']) >= 1) && ($pager['All10'] == $pager['Active10'] + 1)) + { + echo "" . ($pager['Active10'] * $pager['Size'] + 1) . "..." . $pager['AllPages'] . " "; + echo ""; + } + + if ($pager['Active10'] == $pager['All10']) + { + echo ""; + } + + echo '
'; } - - //if (empty($_GET['page'])) return $url.="&".$what."=".$for; - - //print_r($_GET); - - preg_match ("/$what=(.+)/",$url, $xbefore); $before= preg_replace ('/\&.*/','', $xbefore[1]); - $result = str_replace("$what=$before", "$what=$for", $url); - return $result; } -// ================================================================== - +function urlQueryChange ($what, $for) +{ + $url = $_SERVER['REQUEST_URI']; + + if (! isset ($_SERVER['QUERY_STRING']) || isset ($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] == '') + { + + $url .= "?" . $what . "=1"; + } + else + { + + if (! isset ($_GET['page']) or $_GET['page'] == 1) + { + $url .= "&" . $what . "=1"; + } + } + + // if (empty($_GET['page'])) return $url.="&".$what."=".$for; + + // print_r($_GET); + + preg_match ("/$what=(.+)/", $url, $xbefore); + $before = preg_replace ('/\&.*/', '', $xbefore[1]); + $result = str_replace ("$what=$before", "$what=$for", $url); + return $result; +} -function viewBook($table, $value, $what, $title="title") { +// ============== +// ==== VIEW ==== +// ============== - $sql="SELECT `$title` FROM $table WHERE $what='$value' "; - $result = mysql_query($sql) or die(mysql_error()); - $row = mysql_fetch_assoc($result); - - return $row[$title]; - +function viewBook ($table, $value, $what, $title = "title") +{ + $sql = "SELECT `$title` FROM $table WHERE $what='$value' "; + $result = mysql_query ($sql) or die (mysql_error ()); + $row = mysql_fetch_assoc ($result); + + return $row[$title]; } - -function viewBookSelectValue($table, $field, $value_title='title', $default='' ) { - $sql="SELECT $field,$value_title FROM $table"; - $result = mysql_query($sql) or die(mysql_error()); - while ($row = mysql_fetch_assoc($result)) { - if ($default!='') { - if ($row[$field]==$default) { - echo ""; - } else { echo ""; - } - } else { - echo ""; - } - } +function viewBookSelectValue ($table, $field, $value_title = 'title', $default = '') +{ + $sql = "SELECT $field,$value_title FROM $table"; + $result = mysql_query ($sql) or die (mysql_error ()); + while ($row = mysql_fetch_assoc ($result)) + { + if ($default != '') + { + if ($row[$field] == $default) + { + echo ""; + } + else + { + echo ""; + } + } + else + { + echo ""; + } + } } -function urlQueryChange2 ($what, $for, $url='') { - - if ($url=='') { - - $url=$_SERVER['REQUEST_URI']; - - if (!isset($_SERVER['QUERY_STRING']) || isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']=='') { - - $url.='?'.$what."=1"; +function urlQueryChange2 ($what, $for, $url = '') +{ + if ($url == '') + { - } else { + $url = $_SERVER['REQUEST_URI']; - if (!isset($_GET[$what])) { $url.='&'.$what."=1"; } - - } + if (! isset ($_SERVER['QUERY_STRING']) || isset ($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] == '') + { + + $url .= '?' . $what . "=1"; + } + else + { + + if (! isset ($_GET[$what])) + { + $url .= '&' . $what . "=1"; + } + } + } + else + { - } else { - - if (!isset($_GET[$what])) { $url.='&'.$what."=1"; } + if (! isset ($_GET[$what])) + { + $url .= '&' . $what . "=1"; + } } // $url=preg_replace ('/st.*/','', $url); - preg_match ("/$what=(.+)/",$url, $xbefore); $before= preg_replace ('/\&.*/','', $xbefore[1]); - $result = str_replace("$what=$before", "$what=$for", $url); + preg_match ("/$what=(.+)/", $url, $xbefore); + $before = preg_replace ('/\&.*/', '', $xbefore[1]); + $result = str_replace ("$what=$before", "$what=$for", $url); return $result; } -function ChangesOfMass ($a, $b){ - - $mass=''; - - foreach($a as $key=>$value) { - if ($value!=NULL) { - if (in_array($value,$b)) { - $mass['same'][]=$value; - } else { - $mass['add'][]=$value; +function ChangesOfMass ($a, $b) +{ + $mass = ''; + + foreach ($a as $key => $value) + { + if ($value != NULL) + { + if (in_array ($value, $b)) + { + $mass['same'][] = $value; + } + else + { + $mass['add'][] = $value; } } } - foreach($b as $key=>$value) { - if ($value!=NULL) { - if (in_array($value,$a)) { - - } else { - $mass['del'][]=$value; + foreach ($b as $key => $value) + { + if ($value != NULL) + { + if (in_array ($value, $a)) + { + } + else + { + $mass['del'][] = $value; } } - } - - return $mass; + } + + return $mass; } -function GoBack($back=''){ - - global $_SESSION; $url=$_SERVER['REQUEST_URI']; - if (!isset($_SESSION['data']['GoBack'])) {$_SESSION['data']['GoBack']=array("/","/","/");} - if ($_SESSION['data']['GoBack'][0]!=$url) { - array_unshift($_SESSION['data']['GoBack'],$url); - unset($_SESSION['data']['GoBack'][3]); +function GoBack ($back = '') +{ + global $_SESSION; + $url = $_SERVER['REQUEST_URI']; + if (! isset ($_SESSION['data']['GoBack'])) + { + $_SESSION['data']['GoBack'] = array ( + "/", + "/", + "/" + ); + } + if ($_SESSION['data']['GoBack'][0] != $url) + { + array_unshift ($_SESSION['data']['GoBack'], $url); + unset ($_SESSION['data']['GoBack'][3]); } - if ($back!='') { - - echo ""; - + if ($back != '') + { + + echo ""; } - //print_r($_SESSION['data']['GoBack']); + // print_r($_SESSION['data']['GoBack']); } - function AuthorizationUser($post) { - - if (isset($post)) { - - $sql = "SELECT u.*, u.id as user_id FROM zlo_users as u - WHERE u.email='".htmlspecialchars($post['form']['login'],ENT_QUOTES)."' AND u.pass='".htmlspecialchars($post['form']['pass'],ENT_QUOTES)."' "; - $result = mysql_query($sql) or die(mysql_error()); - if (mysql_affected_rows()!=0) { - - $row=mysql_fetch_assoc($result); +function AuthorizationUser ($post) +{ + if (isset ($post)) + { + + $sql = "SELECT u.*, u.id as user_id FROM zlo_users as u + WHERE u.email='" . htmlspecialchars ($post['form']['login'], ENT_QUOTES) . "' AND u.pass='" . htmlspecialchars ($post['form']['pass'], ENT_QUOTES) . "' "; + $result = mysql_query ($sql) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { + + $row = mysql_fetch_assoc ($result); // ===== ===== - $sql2="SELECT * FROM zlo_users_in_out WHERE user_id=".$row['id']." "; - $result2 = mysql_query($sql2) or die(mysql_error()); - if (mysql_affected_rows()!=0) { + $sql2 = "SELECT * FROM zlo_users_in_out WHERE user_id=" . $row['id'] . " "; + $result2 = mysql_query ($sql2) or die (mysql_error ()); + if (mysql_affected_rows () != 0) + { // - $sql2="UPDATE zlo_users_in_out SET `in`=NOW() WHERE user_id=".$row['id']." "; - $result2 = mysql_query($sql2) or die(mysql_error()); - } else { + $sql2 = "UPDATE zlo_users_in_out SET `in`=NOW() WHERE user_id=" . $row['id'] . " "; + $result2 = mysql_query ($sql2) or die (mysql_error ()); + } + else + { // - $sql2="INSERT INTO zlo_users_in_out (user_id,`in`) VALUES (".$row['id'].",NOW())"; - $result2 = mysql_query($sql2) or die(mysql_error()); - + $sql2 = "INSERT INTO zlo_users_in_out (user_id,`in`) VALUES (" . $row['id'] . ",NOW())"; + $result2 = mysql_query ($sql2) or die (mysql_error ()); + // =================== // === === // =================== - - $message=''; - $message[0]=' '; - $message[1]='\n\r\n\r '; - $message[2]='\n\r\n\r , , , , , extremstyle.ua. .'; - $message[3]='\n\r\n\r , , . , 100% .'; - $message[4]='\n\r\n\r '; - $message[5]='\n\r\n\r extremstyle.ua, . , extremstyle.ua , .'; - $message[6]='\n\r\n\r extremstyle.ua . extremstyle.ua , .'; - $message[7]='\n\r\n\r - extremstyle.ua, .'; - $_SESSION['alert']['message']=implode(" ", $message); - - echo ''; - unset($_SESSION['alert']['message']); + $message = ''; + $message[0] = ' '; + $message[1] = '\n\r\n\r '; + $message[2] = '\n\r\n\r , , , , , extremstyle.ua. .'; + $message[3] = '\n\r\n\r , , . , 100% .'; + $message[4] = '\n\r\n\r '; + $message[5] = '\n\r\n\r extremstyle.ua, . , extremstyle.ua , .'; + $message[6] = '\n\r\n\r extremstyle.ua . extremstyle.ua , .'; + $message[7] = '\n\r\n\r - extremstyle.ua, .'; + + $_SESSION['alert']['message'] = implode (" ", $message); + + echo ''; + unset ($_SESSION['alert']['message']); } - $_SESSION['user']['id'] =$row['user_id']; - $_SESSION['user']['login'] =$row['username']; - $_SESSION['user']['pass'] =$row['pass']; - $_SESSION['user']['name'] =$row['username']; - $_SESSION['user']['email'] =$row['email']; - $_SESSION['user']['tel'] =$row['tel']; - $_SESSION['user']['tel2'] =$row['tel2']; - $_SESSION['user']['address']=$row['address']; - $_SESSION['user']['city'] =$row['city']; + $_SESSION['user']['id'] = $row['user_id']; + $_SESSION['user']['login'] = $row['username']; + $_SESSION['user']['pass'] = $row['pass']; + $_SESSION['user']['name'] = $row['username']; + $_SESSION['user']['email'] = $row['email']; + $_SESSION['user']['tel'] = $row['tel']; + $_SESSION['user']['tel2'] = $row['tel2']; + $_SESSION['user']['address'] = $row['address']; + $_SESSION['user']['city'] = $row['city']; // ======================= // === === // ======================= - $message=''; + $message = ''; // - $sql = "SELECT id FROM zlo_users_message WHERE `status`=3 AND `to`='".$_SESSION['user']['id']."'"; - $result = mysql_query($sql) or die(mysql_error()); - $total_messages=mysql_affected_rows(); - if ($total_messages!=0) { - $message=" ($total_messages) "; + $sql = "SELECT id FROM zlo_users_message WHERE `status`=3 AND `to`='" . $_SESSION['user']['id'] . "'"; + $result = mysql_query ($sql) or die (mysql_error ()); + $total_messages = mysql_affected_rows (); + if ($total_messages != 0) + { + $message = " ($total_messages) "; } - - + // ======================= // ==== === // ======================= - + $sql = "SELECT a.id FROM zlo_users_audience AS a WHERE a.`date_end` > NOW( ) @@ -571,19 +648,29 @@ function GoBack($back=''){ AND a.id NOT IN ( SELECT audience_id FROM zlo_users_audience_answers AS w - WHERE w.user_id ='".$_SESSION['user']['id']."')"; - $result = mysql_query($sql) or die(mysql_error()); - $total_audience=mysql_affected_rows(); - if ($total_audience!=0) { - $message.='\n ('.$total_audience.')'; + WHERE w.user_id ='" . $_SESSION['user']['id'] . "')"; + $result = mysql_query ($sql) or die (mysql_error ()); + $total_audience = mysql_affected_rows (); + if ($total_audience != 0) + { + $message .= '\n (' . $total_audience . ')'; } - if($message!='') { echo(""); } - - } else { echo ("");} - - } - + if ($message != '') + { + echo (""); + } + } + else + { + echo (""); + } } +} + +function htmlMessage ($status, $text) +{ + return '
'.$text.'
'; +} ?> \ No newline at end of file diff --git a/ajax/OrderContol.php b/ajax/OrderContol.php new file mode 100644 index 0000000..de9314b --- /dev/null +++ b/ajax/OrderContol.php @@ -0,0 +1,55 @@ + 0) + { + $row = mysql_fetch_assoc ($result); + + // меняем заказ + $field_order = $field == 'tel' ? 'phone' : 'phonemob'; + + $sql = ' + UPDATE `catalogs_orders` + SET '.$field_order.' = "'.$_GET['value'].'" + WHERE id = '.(int)$_GET['order_id'].' + '; + $result = mysql_query($sql) or die(mysql_error()); + + // меняем пользователя + $sql = ' + UPDATE `zlo_users` + SET '.$field.' = "'.$_GET['value'].'" + WHERE id = '.(int)$row['user_id'].' + '; + $result = mysql_query($sql) or die(mysql_error()); + + echo json_encode (array ( + 'html' => htmlMessage ('success', 'Телефон успешно сохранен') + )); + } + else + { + echo json_encode (array ( + 'html' => htmlMessage ('error', 'Заказ не найден!') + )); + } + + break; +} \ No newline at end of file diff --git a/js/OrderContol.js b/js/OrderContol.js index f810a21..51030a7 100644 --- a/js/OrderContol.js +++ b/js/OrderContol.js @@ -1,11 +1,57 @@ +// ================== +// ==== function ==== +// ================== + + // =============== + // ==== ==== + // =============== + + function getUrlVars (name) + { + name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); + } - // ===================== - // ===== javascript ==== - // ===================== + function RemoveDiv(div) + { + if(typeof div== 'string') div=document.getElementById(div); + if(div && div.parentNode)div.parentNode.removeChild(div); + SumPerRow(); + + return false; + } + + function notify(url) + { + if (confirm(" ?")) + { + document.location = url; + return true; + } + return false; + } + + function empty (mixed_var) { + if (mixed_var === "" || mixed_var === 0 || mixed_var === "0" || mixed_var === null || mixed_var === false || typeof mixed_var === 'undefined') { + return true; + } + } - // ================================ - // ==== ==== - // ================================ + function isset(id) { + + if((document) && (document.getElementById(id))) { + return true; + } else { + return false; + } + + } + + // =============== + // ==== ==== + // =============== var c = 0; var CleanRow = ''; @@ -98,18 +144,18 @@ function flyFind(value, number) { // ==== flyFind ==== - $.post("/ajax/flySearch.php", {load:'search',what: ""+value+"", row_number: number}, function(data,textStatus){ - if (data!=0) { + $.post("/ajax/flySearch.php", { + load:'search',what: ""+value+"", row_number: number}, function(data,textStatus) + { + if (data!=0) + { window.document.getElementById('livesearch'+number).innerHTML=data; // document.getElementById('livesearch'+number).style.display='block'; - } - - }); - + } + }); return false; - } function displaySearch(id){ @@ -118,15 +164,14 @@ function selectFirst(key) { // ==== ==== - // Mozilla - if(key==40) { - window.document.getElementById('searchSelect('+c+')').focus(); - window.document.getElementById('searchSelect('+c+')').selectedIndex=0; - - } - - return false; + // Mozilla + if(key == 40) + { + window.document.getElementById('searchSelect('+c+')').focus(); + window.document.getElementById('searchSelect('+c+')').selectedIndex=0; + } + return false; } function SubmitForm(key) { // ==== ENTER - ==== @@ -291,24 +336,24 @@ // ==== Tel ===== // ============== - function livesearchTel(value) { // ==== livesearchEmail ==== - - $.post("/ajax/flySearch.php", {load:'searchTel',what: ""+value+""}, function(data,textStatus){ - if (data!=0) { + function livesearchTel(value) + { + $.post("/ajax/flySearch.php", {load:'searchTel',what: ""+value+""}, function(data,textStatus) + { + if (data!=0) + { window.document.getElementById('livesearch-tel-list').innerHTML=data; // document.getElementById('livesearch-tel-list').style.display='block'; - } - - }); - - + } + }); + return false; } - function SelectTel(){ // ==== ==== - + function SelectTel() + { // var _obj = document.getElementById('choose-tel'); _value=document.getElementById('telValue'); @@ -338,32 +383,76 @@ } - function SelectTelFirst(key) { // ==== ==== - - // Mozilla - if(key==40) { - window.document.getElementById('livesearch-tel-list').focus(); - window.document.getElementById('livesearch-tel-list').selectedIndex=0; - } - - return false; + function SelectTelFirst(key) + { + // Mozilla + if (key == 40) + { + window.document.getElementById('livesearch-tel-list').focus(); + window.document.getElementById('livesearch-tel-list').selectedIndex=0; + } + return false; } - function SelectTelSubmit(key) { // ==== ENTER - ==== + function SelectTelSubmit(key) + { + // ENTER - + + // Mozilla + if (key == 13) + { + SelectTel(); + } - //Mozilla - if (key==13) { - SelectTel(); - } - - return false; + return false; } - - - // ============== - // =unknownUser = - // ============== + + function telAction ($array) + { + $.ajax({ + type: 'GET', + url: '/ajax/OrderContol.php', + dataType: 'json', + data: $.param ($array['json']), + success: function (response) + { + switch ($array['json']['jaction']) + { + case 'tel-save': + + modalBoxLoad (response.html, { + autoClose: 800, + }); + break; + } + }, + error: function() + { + modalBoxLoad ('- ...'); + } + }); +/* + $.post({ + url: '/js/OrderContol.php?jaction=' + $array['json']['jaction'], + queryString: 1, + }) + .done(function (response) + { + modalBoxLoad (response.html, { + autoClose: 600, + }); + }) + .fail (function() + { + modalBoxLoad ('- ...'); + }); + */ + } + + // ===================== + // ==== unknownUser ==== + // ===================== function newUnknownUser() { @@ -387,9 +476,9 @@ } } - // =================== - // == userCheckData == - // =================== + // ======================= + // ==== userCheckData ==== + // ======================= function userCheckData(value,fields) { // ==== livesearchEmail ==== @@ -406,44 +495,100 @@ return false; } - - - // ============================= - // ==== ==== - // ============================= - - function RemoveDiv(div) { // ==== div ==== + +// =================== +// ==== LISTENERS ==== +// =================== - if(typeof div== 'string') div=document.getElementById(div); - if(div && div.parentNode)div.parentNode.removeChild(div); - SumPerRow(); +jQuery(document).ready(function() +{ - return false; - } + $(".input_status").click(function() + { + $( "#status_box_"+$(this).attr("data-id") ).show(); + }) - function notify(url){ + $( ".status_box ul li.name_city" ).click(function() + { + $("#input_status_"+$(this).attr("data-id")).val($(this).text()); + $( ".status_box" ).hide(); + }); + + $( ".status_box ul li.other" ).click(function() + { + $("#input_status_"+$(this).attr("data-id")).val(""); + $( ".status_box" ).hide(); + $("#input_status_"+$(this).attr("data-id")).focus(); + }); + + $(".need-confirm").click(function(e) + { + e.preventDefault(); - if(confirm(" ?")){ - document.location=url; + if (confirm (" ?") == true) + { + window.location = $(this).attr("href"); + return true; } + return false; - } + }); - function empty (mixed_var) { - if (mixed_var === "" || mixed_var === 0 || mixed_var === "0" || mixed_var === null || mixed_var === false || typeof mixed_var === 'undefined') { - return true; - } - } + $("#sms_tpl").change(function() + { + $.get("/ajax/sms_tpl.php", { tplID: this.value },function(data) { + $("#sms_msg").val(data); + $("#sms_c").html($("#sms_msg").val().length); + }); + }); - function isset(id) { - - if((document) && (document.getElementById(id))) { + $("#sms_send").click(function() + { + if($("#sms_tel1").attr("checked") || $("#sms_tel2").attr("checked")) { return true; - } else { + }else{ + alert(" !"); return false; } + }); - } + w=120; + + $("input[name=\'sms_type\']").click(function() + { + i = $("#sms_msg").val().length; + if(this.value=="l"){w=120;if(i>w){$("#sms_c").css( "color","red" );}else{$("#sms_c").css( "color","black" );}} + else{w=70;if(i>w){$("#sms_c").css( "color","red" );}else{$("#sms_c").css( "color","black" );}} + $("#sms_c_sum").html(w); + }); + + $("#sms_c_sum").html(w); + + + $("#sms_msg").keyup(function() + { + i = this.value.length; + if(i>w){$("#sms_c").css( "color","red" );} + else{$("#sms_c").css( "color","black" );} + $("#sms_c").html(i); + }); + + // + // $("#add-item").validationEngine(); + + + // + $('.info.tel input').on('change', function() + { + telAction({ + 'json': { + 'jaction': 'tel-save', + 'field': $(this).attr('name'), + 'value': $(this).val(), + 'order_id': getUrlVars('order_ID'), + } + }); + }); - \ No newline at end of file +}); \ No newline at end of file -- libgit2 0.21.4