���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/vidoe.top/admin_new/mod/ |
<?php class city{ function city (){ global $CORE, $TBS; $TBS->LoadTemplate(ADMIN_PATH."skin/city.html"); switch($CORE->input['code']){ default : $this->goList(); break; case 'post': $this->goPost(); break; case 'del': $this->goDel(); break; } } function goList(){ global $CORE, $DB, $TBS, $print, $mp; $showsection = 0; $TBS->MergeField('showsection',$showsection); if(!$CORE->input['reoder']){ // show list---------------- $pageNum = ($_GET['pageNum']>0) ? intval($_GET['pageNum']) : 1; $pageSize = 20; $from = (($pageNum * $pageSize) - $pageSize); //$t = $DB->query("SELECT a.id FROM NNCCMS_product"); $temp = $DB->fetch_row($DB->query("SELECT count(ID_city) as total FROM NNCCMS_city")); $total = $temp['total']; $totalPage = ceil($total / $pageSize); $num['empty'] = ($DB->get_num_rows($temp)==0) ? 1 : 0; $q = $DB->query("SELECT * FROM NNCCMS_city ORDER BY city_name LIMIT $from, $pageSize"); while ($data = $DB->fetch_row($q)){ $cat[] = $data; } $show[] = $num; $TBS->MergeBlock('show',$show); $nav = $print->Pagination($totalPage,$pageNum,$CORE->admin_url.'&act=city'); $TBS->MergeField('nav',$nav); $TBS->MergeBlock('cat',$cat); $TBS->Show(TBS_OUTPUT+TBS_NOTHING); }else{ // do re oder --------------------------------------- $input_arr = $CORE->input; $t = $DB->compile_query("ID_city,pos","NNCCMS_city","",''); while($row = $DB->fetch_row($t)){ foreach($input_arr as $k => $v){ $k = intval ($k); $v = intval ($v); if($row['ID_city']==$k){ $DB->query("update NNCCMS_city set pos='$v' where ID_city='$k'"); } } } $url = $CORE->admin_url."&act=city"; $text = "Đã lưu thứ tự"; $print->redirect ($text,$url); } } function goPost(){ global $CORE, $DB, $func, $TBS, $print; $showsection = 1; $TBS->MergeField('showsection',$showsection); $id = intval($CORE->input['id']); if($_SESSION['error']) unset($CORE->input['bsubmit']); // Show post ----------------------------------------------------------------------- if(!$CORE->input['bsubmit']){ if ($_SESSION['error']) $prevError = $_SESSION['error']; unset($_SESSION['error']); if ($_SESSION['state']) $prevState = $_SESSION['state']; unset($_SESSION['state']); if($prevState!=NULL){ $data = $prevState; }else{ if($id==0){ $data['status'] = 1; }else{ $temp=$DB->query("SELECT * FROM NNCCMS_city WHERE ID_city='".$id."'"); $data = $DB->fetch_row($temp); } } //$data['sub'] = $func->drop_down_menu('sub',$data['scat'],'NNCCMS_brandcat','cid','cname',"WHERE scat=0"); $data['status'] = $func->yes_no($data['status'],'status'); $error[] = $prevError; $post[] = $data; $TBS->MergeBlock('error',$error); $TBS->MergeBlock('post',$post); $TBS->Show(TBS_OUTPUT+TBS_NOTHING); // Do post ------------------------------------------- }else{ $name = $CORE->input['name']; $post_code = $CORE->input['post_code']; $percent = floatval($CORE->input['percent']); $pos = intval($CORE->input['pos']); $status = intval($CORE->input['status']); //$sub = intval($CORE->input['sub']); // -------------- check ------------------------- if($name=='') $error['name'] = 1; $query_check=$DB->query("SELECT * FROM NNCCMS_city WHERE code = '$post_code'"); if($DB->get_num_rows($query_check)>0 && $id==0) exit('Lỗi! Mã vùng '.$post_code.' đã có xin nhập mã khác, bấm <a href="?act=city&code=post">Vào đây</a> để quay về!'); // If detects any errors then return to the postform with errors if($error!=''){ $_SESSION['error'] = $error; $_SESSION['state'] = $state; return $this->goPost(); } // Do Add ------------------ if(!$id || $id==0){ $DB->query("INSERT INTO `NNCCMS_city`(`ID_city`,`city_name`,`code`,`percent`,`pos`,`status`) VALUES ( '', '$name','$post_code','$percent','$pos','$status')"); // Do Edit ----------------- }else{ $DB->query("UPDATE `NNCCMS_city` SET `city_name` = '$name',`code` = '$post_code',`percent`='$percent',`pos`='$pos',`status` = '$status' WHERE `ID_city`='$id'"); } $url=$CORE->admin_url."&act=city"; $print->redirect ("Đã cập nhật ...",$url); } } function goDel(){ global $CORE, $DB, $print; $id = intval($CORE->input['id']); $query = $DB->query("SELECT * FROM NNCCMS_city WHERE `ID_city`='$id' LIMIT 1"); $DB->query("DELETE FROM NNCCMS_city WHERE `ID_city`='$id'"); $url = $CORE->admin_url."&act=city"; $text = "Đã xóa..."; $print->redirect ($text,$url); } } $run = new city(); ?>