Example #1
0
 function edit_category()
 {
     $this->isset_cookie();
     if (isset($_GET['id'])) {
         $id = addslashes($_GET['id']);
         $sql = "update " . $this->table_name('category') . " set edit_by='" . $_SESSION[$this->shop_name]['h_id'] . "'  where cat_id='{$id}'";
         $a = mysql_query($sql, $this->conn);
         require_once MANAGE_MOD . 'uploaded_file.php';
         $path = "/data/category_doc/";
         $doc_src = uploaded_m_file($this->table_name('img'), 'original_src', 'file_url', $path);
         if (!empty($_POST['edit_doc'])) {
             foreach ($_POST['edit_doc'] as $k => $v) {
                 $sql = "select * from " . $this->table_name('img') . " where img_id='" . $_POST['img_id'][$k] . "' ";
                 $img_b = getFetchAll($sql, $this->conn);
                 if (!empty($img_b)) {
                     if ($v == 1) {
                         $img_sql = " , original_src='" . $doc_src[$k] . "' ";
                         @unlink('.' . $img_b[0]['original_src']);
                     } else {
                         $img_sql = "";
                     }
                     // order_by='".$_POST['order_by'][$k]."',
                     $sql = "update " . $this->table_name('img') . " set original_link='" . $_POST['original_link'][$k] . "',is_show='" . $_POST['is_showi'][$k] . "',edit_by='" . $_SESSION[$this->shop_name]['h_id'] . "' " . $img_sql . " where img_id='" . $_POST['img_id'][$k] . "' ";
                 } else {
                     if ($v == 1) {
                         $img_sql = ",original_link";
                         $img_sql1 = ",'" . $doc_src[$k] . "'";
                     } else {
                         $img_sql = "";
                         $img_sql1 = "";
                     }
                     $sql = "insert into " . $this->table_name('img') . "(type_id,type,original_link" . $img_sql . ",is_show,add_by ,add_time,edit_by) values('" . $id . "','C','" . $_POST['original_link'][$k] . "'" . $img_sql1 . ",'" . $_POST['is_showi'][$k] . "','" . $_SESSION[$this->shop_name]['h_id'] . "','" . $d . "','" . $_SESSION[$this->shop_name]['h_id'] . "')";
                 }
                 $c = mysql_query($sql, $this->conn);
             }
         }
         if ($a) {
             if (!empty($_POST['detail'])) {
                 foreach ($_POST['detail'] as $k => $v) {
                     $art_detail = addslashes(implode('":;"', $v));
                     $sql = "update " . $this->table_name('category_i8n') . " set cat_detail='" . $art_detail . "'  where cat_i8n_id='" . $_POST['iid'][$k] . "'";
                     $b = mysql_query($sql, $this->conn);
                 }
             }
             js_redir('index.php?a=admin&m=main_right');
         } else {
             js_alert('修改失败,请联系系统管理员');
         }
     } else {
         js_alert_redir('登录错误请重新再试', 'index.php?a=main&m=login');
     }
 }
Example #2
0
 function edit_news()
 {
     $this->isset_cookie();
     if (isset($_GET['id'])) {
         $id = $_GET['id'];
         $d = date("Y-m-d H:i:s");
         $sql = "update " . $this->table_name('article') . " set edit_by='" . $_SESSION[$this->shop_name]['h_id'] . "'  where art_id='{$id}'";
         $a = mysql_query($sql, $this->conn);
         require_once MANAGE_MOD . 'uploaded_file.php';
         $path = "/data/news_doc/";
         $doc_src = uploaded_m_file($this->table_name('img'), 'original_src', 'file_url', $path);
         if (!empty($_POST['edit_doc'])) {
             foreach ($_POST['edit_doc'] as $k => $v) {
                 if ($v == 1) {
                     $sql = "select * from " . $this->table_name('img') . " where img_id='" . $_POST['img_id'][$k] . "' ";
                     $img_b = getFetchAll($sql, $this->conn);
                     if (!empty($img_b)) {
                         @unlink('.' . $img_b[0]['original_src']);
                         $sql = "update " . $this->table_name('img') . " set original_src='" . $doc_src[$k] . "',edit_by='" . $_SESSION[$this->shop_name]['h_id'] . "' where img_id='" . $_POST['img_id'][$k] . "' ";
                         $c = mysql_query($sql, $this->conn);
                     } else {
                         $p = explode('-', $k);
                         $sql = "insert into " . $this->table_name('img') . "(type_id,type,original_src,add_by ,add_time,edit_by,i8n) values('" . $id . "','A','" . $doc_src[$k] . "','" . $_SESSION[$this->shop_name]['h_id'] . "','" . $d . "','" . $_SESSION[$this->shop_name]['h_id'] . "','" . $p[1] . "')";
                         $c = mysql_query($sql, $this->conn);
                     }
                 }
             }
         }
         if ($a) {
             if (!empty($_POST['detail'])) {
                 foreach ($_POST['detail'] as $k => $v) {
                     $art_detail = addslashes(implode('":;"', $v));
                     $sql = "update " . $this->table_name('article_i8n') . " set art_detail='" . $art_detail . "'  where art_i8n_id='" . $_POST['iid'][$k] . "'";
                     $b = mysql_query($sql, $this->conn);
                 }
             }
             //$this->index();
             js_redir('index.php?a=admin&m=main_right');
         } else {
             js_alert('修改失败,请联系系统管理员');
         }
     } else {
         js_alert_redir('登录错误请重新再试', 'index.php?a=main&m=login');
     }
 }
Example #3
0
 function edit_product()
 {
     $this->isset_cookie();
     $d = date("Y-m-d H:i:s");
     $c_id = $_POST['c_id'];
     require_once MANAGE_MOD . 'uploaded_file.php';
     $path = "/data/product_doc/";
     $doc_src = uploaded_m_file($this->table_name('img'), 'original_src', 'file_url', $path);
     //pr($doc_src);die;
     if ($_GET['id'] != '' && $_POST['act'] == 'edit') {
         $id = $_GET['id'];
         $sql = "update " . $this->table_name('goods') . " set is_show='" . $_POST['is_show'] . "',edit_by='" . $_SESSION[$this->shop_name]['h_id'] . "' where goods_id='{$id}'";
         $a = mysql_query($sql, $this->conn);
         if (!empty($_POST['edit_doc'])) {
             foreach ($_POST['edit_doc'] as $k => $v) {
                 $sql = "select * from " . $this->table_name('img') . " where img_id='" . $_POST['img_id'][$k] . "' ";
                 $img_b = getFetchAll($sql, $this->conn);
                 if (!empty($img_b) && $_POST['acti'][$k] == 'del') {
                     @unlink('.' . $img_b[0]['original_src']);
                     $sql = "delete from " . $this->table_name('img') . " where img_id='" . $_POST['img_id'][$k] . "' ";
                     $c = mysql_query($sql, $this->conn);
                 } else {
                     if (!empty($img_b)) {
                         if ($v == 1) {
                             $src = ",original_src='" . $doc_src[$k] . "'";
                             @unlink('.' . $img_b[0]['original_src']);
                         } else {
                             $src = "";
                         }
                         if (isset($_POST['is_showi'][$k])) {
                             $where = " ,is_show='" . $_POST['is_showi'][$k] . "'";
                         } else {
                             $where = "";
                         }
                         $sql = "update " . $this->table_name('img') . " set order_by='" . $_POST['order_by'][$k] . "',edit_by='" . $_SESSION[$this->shop_name]['h_id'] . "'" . $where . $src . " where img_id='" . $_POST['img_id'][$k] . "' ";
                         $c = mysql_query($sql, $this->conn);
                     } else {
                         if ($v == 1) {
                             $p = explode('-', $k);
                             if (!empty($_POST['is_show'][$k])) {
                                 $where = $_POST['is_show'][$k];
                             } else {
                                 $where = "1";
                             }
                             $sql = "insert into " . $this->table_name('img') . "(type_id,order_by,is_show,type,original_src,add_by ,add_time,edit_by,point,i8n) values('" . $id . "','" . $_POST['order_by'][$k] . "','" . $where . "','P','" . $doc_src[$k] . "','" . $_SESSION[$this->shop_name]['h_id'] . "','" . $d . "','" . $_SESSION[$this->shop_name]['h_id'] . "','" . $p[2] . "','" . $p[1] . "')";
                             $c = mysql_query($sql, $this->conn);
                         }
                     }
                 }
             }
         }
         if ($a) {
             if (!empty($_POST['detail'])) {
                 foreach ($_POST['detail'] as $k => $v) {
                     $title = addslashes(implode('<br />', $_POST['title'][$k]));
                     $overview = addslashes($_POST['overview'][$k]);
                     $art_detail = addslashes(implode('":;"', $v));
                     $sql = "update " . $this->table_name('goods_i8n') . " set goods_name='" . $title . "',goods_overview='" . $overview . "',goods_detail='" . $art_detail . "'  where goods_i8n_id='" . $_POST['iid'][$k] . "'";
                     $b = mysql_query($sql, $this->conn);
                 }
             }
             js_redir('index.php?a=product&m=index&id=' . $c_id);
         } else {
             js_alert('修改失败,请联系系统管理员');
         }
     } else {
         if ($_POST['act'] == 'add') {
             $sql = "insert into " . $this->table_name('goods') . "(cat_id,is_show,order_by,add_by,add_time,edit_by) values ('" . $c_id . "','" . $_POST['is_show'] . "','50','" . $_SESSION[$this->shop_name]['h_id'] . "','" . $d . "','" . $_SESSION[$this->shop_name]['h_id'] . "') ";
             $a = mysql_query($sql, $this->conn);
             $id = mysql_insert_id();
             if (!empty($_POST['edit_doc'])) {
                 foreach ($_POST['edit_doc'] as $k => $v) {
                     $sql = "select * from " . $this->table_name('img') . " where img_id='" . $_POST['img_id'][$k] . "' ";
                     $img_b = getFetchAll($sql, $this->conn);
                     if (!empty($img_b) && $_POST['acti'][$k] == 'del') {
                         @unlink('.' . $img_b[0]['original_src']);
                         $sql = "delete from " . $this->table_name('img') . " where img_id='" . $_POST['img_id'][$k] . "' ";
                         $c = mysql_query($sql, $this->conn);
                     } else {
                         if (!empty($img_b)) {
                             if ($v == 1) {
                                 $src = ",original_src='" . $doc_src[$k] . "'";
                                 @unlink('.' . $img_b[0]['original_src']);
                             } else {
                                 $src = "";
                             }
                             if (isset($_POST['is_showi'][$k])) {
                                 $where = " ,is_show='" . $_POST['is_showi'][$k] . "'";
                             } else {
                                 $where = "";
                             }
                             $sql = "update " . $this->table_name('img') . " set order_by='" . $_POST['order_by'][$k] . "',edit_by='" . $_SESSION[$this->shop_name]['h_id'] . "'" . $where . $src . " where img_id='" . $_POST['img_id'][$k] . "' ";
                             $c = mysql_query($sql, $this->conn);
                         } else {
                             if ($v == 1) {
                                 $p = explode('-', $k);
                                 if (!empty($_POST['is_show'][$k])) {
                                     $where = $_POST['is_show'][$k];
                                 } else {
                                     $where = "1";
                                 }
                                 $sql = "insert into " . $this->table_name('img') . "(type_id,order_by,is_show,type,original_src,add_by ,add_time,edit_by,point,i8n) values('" . $id . "','" . $_POST['order_by'][$k] . "','" . $where . "','P','" . $doc_src[$k] . "','" . $_SESSION[$this->shop_name]['h_id'] . "','" . $d . "','" . $_SESSION[$this->shop_name]['h_id'] . "','" . $p[2] . "','" . $p[1] . "')";
                                 $c = mysql_query($sql, $this->conn);
                             }
                         }
                     }
                 }
             }
             if ($a) {
                 if (!empty($_POST['detail'])) {
                     foreach ($_POST['detail'] as $k => $v) {
                         $title = addslashes(implode('<br />', $_POST['title'][$k]));
                         $overview = addslashes($_POST['overview'][$k]);
                         $art_detail = addslashes(implode('":;"', $v));
                         $sql = "insert into " . $this->table_name('goods_i8n') . "(goods_id,goods_name,goods_overview,goods_detail,i8n) values('" . $id . "','" . $title . "','" . $overview . "','" . $art_detail . "','" . $k . "')";
                         $b = mysql_query($sql, $this->conn);
                     }
                 }
                 js_redir('index.php?a=product&m=index&id=' . $c_id);
             } else {
                 js_alert('添加失败,请联系系统管理员');
             }
         } else {
             js_alert_redir('登录错误请重新再试', 'index.php?a=main&m=login');
         }
     }
 }
Example #4
0
 function edit_menu()
 {
     $this->isset_cookie();
     require_once MANAGE_MOD . 'uploaded_file.php';
     $path = "/data/menu_doc/";
     $doc_src = uploaded_m_file($this->table_name('img'), 'original_src', 'file_url', $path);
     if ($_POST['p_link'] == '0') {
         $links = $this->specifyChar($_POST['goods_sn']);
     } else {
         $links = $this->specifyChar($_POST['goods_sn1']);
     }
     if (isset($_GET['productid']) && $_POST['act'] == 'edit') {
         $productid = $_GET['productid'];
         $sql = "update " . $this->table_name('menu') . " set parent_id='" . $_POST['p_id'] . "',type='" . $_POST['parent_id'] . "',link_type='" . $_POST['p_link'] . "',link='" . $links . "',is_show='" . $_POST['is_show'] . "',order_by='" . $_POST['order_by'] . "',edit_by='" . $_SESSION[$this->shop_name]['h_id'] . "' where menu_id='{$productid}'";
         $a = mysql_query($sql, $this->conn);
         if (!empty($doc_src)) {
             foreach ($doc_src as $k => $v) {
                 if ($v != "") {
                     $sql = "insert into " . $this->table_name('img') . "(type_id,type,img_title,original_src,order_by,add_by ,add_time,edit_by) values('" . $productid . "','M','" . $this->specifyChar($_POST['img_name'][$k]) . "','{$v}','" . $_POST['img_by'][$k] . "','" . $_SESSION[$this->shop_name]['h_id'] . "','" . $d . "','" . $_SESSION[$this->shop_name]['h_id'] . "')";
                     $b = mysql_query($sql, $this->conn);
                 }
             }
         }
         if (!empty($_POST['edit_by'])) {
             foreach ($_POST['edit_by'] as $k => $v) {
                 $sql = "update " . $this->table_name('img') . " set order_by='" . $v . "',img_title='" . $this->specifyChar($_POST['edit_name'][$k]) . "' where img_id='" . $k . "' ";
                 $c = mysql_query($sql, $this->conn);
             }
         }
         if ($a) {
             $sql = "update " . $this->table_name('menu_i8n') . " set menu_name='" . $_POST['title'] . "',menu_detail='" . $_POST['info'] . "' where menu_i8n_id='" . $_POST['iid'] . "'";
             $b = mysql_query($sql, $this->conn);
             $sql = "update " . $this->table_name('menu_i8n') . " set menu_name='" . $_POST['title_c'] . "',menu_detail='" . $_POST['info_c'] . "' where menu_i8n_id='" . $_POST['iid_c'] . "'";
             $b = mysql_query($sql, $this->conn);
             $sql = "update " . $this->table_name('menu_i8n') . " set menu_name='" . $_POST['title_t'] . "',menu_detail='" . $_POST['info_t'] . "' where menu_i8n_id='" . $_POST['iid_t'] . "'";
             $b = mysql_query($sql, $this->conn);
             $this->index();
         } else {
             js_alert('修改失败,请联系系统管理员');
         }
     } else {
         if ($_POST['act'] == 'add') {
             $d = date("Y-m-d H:i:s");
             $sql = "insert into " . $this->table_name('menu') . "(parent_id,type,link_type,link,is_show,order_by,add_by,add_time,edit_by) values ('" . $_POST['p_id'] . "','" . $_POST['parent_id'] . "','" . $_POST['p_link'] . "','" . $links . "','" . $_POST['is_show'] . "','" . $_POST['order_by'] . "','" . $_SESSION[$this->shop_name]['h_id'] . "','" . $d . "','" . $_SESSION[$this->shop_name]['h_id'] . "') ";
             $a = mysql_query($sql, $this->conn);
             $id = mysql_insert_id();
             if (!empty($doc_src)) {
                 foreach ($doc_src as $k => $v) {
                     if ($v != "") {
                         $sql = "insert into " . $this->table_name('img') . "(type_id,type,img_title,original_src,order_by,add_by ,add_time,edit_by) values('" . $id . "','M','" . $this->specifyChar($_POST['img_name'][$k]) . "','{$v}','" . $_POST['img_by'][$k] . "','" . $_SESSION[$this->shop_name]['h_id'] . "','" . $d . "','" . $_SESSION[$this->shop_name]['h_id'] . "')";
                         $b = mysql_query($sql, $this->conn);
                     }
                 }
             }
             if ($a) {
                 $sql = "insert into " . $this->table_name('menu_i8n') . "(menu_id,menu_name,menu_detail,i8n) values('" . $id . "','" . $_POST['title'] . "','" . $_POST['info'] . "','en_us')";
                 $b = mysql_query($sql, $this->conn);
                 $sql = "insert into " . $this->table_name('menu_i8n') . "(menu_id,menu_name,menu_detail,i8n) values('" . $id . "','" . $_POST['title_c'] . "','" . $_POST['info_c'] . "','zh_cn')";
                 $b = mysql_query($sql, $this->conn);
                 $sql = "insert into " . $this->table_name('menu_i8n') . "(menu_id,menu_name,menu_detail,i8n) values('" . $id . "','" . $_POST['title_t'] . "','" . $_POST['info_t'] . "','zh_tw')";
                 $b = mysql_query($sql, $this->conn);
                 $this->index();
             } else {
                 js_alert('添加失败,请联系系统管理员');
             }
         } else {
             js_alert_redir('登录错误请重新再试', 'index.php?a=main&m=login');
         }
     }
 }