<?php $url = "../index.php?mod=text&act=list"; require_once "../model/Backend.php"; $model = new Backend(); $id = (int) $_POST['id']; $arrData['text'] = $text = trim($_POST['text']); $table = "text"; if ($id > 0) { $arrData['id'] = $id; $model->update($table, $arrData); } else { $model->insert($table, $arrData); } header('location:' . $url);
<?php $url = "../index.php?mod=block&act=list"; require_once "../model/Backend.php"; $model = new Backend(); $id = (int) $_POST['id']; $arrData['name_vi'] = $name_vi = $_POST['name_vi']; $arrData['name_en'] = $name_en = $_POST['name_en']; if ($id > 0) { $arrData['id'] = $id; $model->update('block', $arrData); mysql_query("DELETE FROM link WHERE block_id = {$id}"); } if (!empty($_POST['text_vi'])) { foreach ($_POST['text_vi'] as $key => $text_vi) { if (isset($_POST['link_vi'][$key]) && $_POST['link_vi'][$key] != '' && isset($_POST['link_en'][$key]) && $_POST['link_en'][$key] != '' && isset($_POST['text_en'][$key]) && $_POST['text_en'][$key] != '') { $arrLink['text_vi'] = $_POST['text_vi'][$key]; $arrLink['text_en'] = $_POST['text_en'][$key]; $arrLink['link_url_vi'] = $_POST['link_vi'][$key]; $arrLink['link_url_en'] = $_POST['link_en'][$key]; $arrLink['block_id'] = $id; $arrLink['status'] = 1; $model->insert('link', $arrLink); $arrLink = array(); } } } header('location:' . $url);
$customerArr['phone'] = $model->processData($_POST['phone']); $customerArr['email'] = $model->processData($_POST['email']); $customerArr['birthday'] = $model->processData($_POST['birthday']); $customerArr['address'] = $model->processData($_POST['address']); $customerArr['cmnd'] = $model->processData($_POST['cmnd']); $customerArr['updated_at'] = time(); $customerArr['user_id'] = $user_id; $customerArr['status'] = 1; $customerArr['is_main'] = 1; $customer_id = (int) $_POST['customer_id']; if ($customer_id > 0) { $customerArr['id'] = $customer_id; $model->update('customers', $customerArr); } else { $customerArr['created_at'] = time(); $customer_id = $model->insert('customers', $customerArr); } } } else { $customer_id = $customer_id_old; } if ($customer_id > 0) { $contractArr['object_id'] = (int) $_POST['object_id']; $contractArr['customer_id'] = $customer_id; $contractArr['object_type'] = (int) $_POST['object_type']; $contractArr['code'] = $model->processData($_POST['code']); $contractArr['user_id'] = $user_id; $contractArr['no_person'] = (int) $_POST['no_person']; $contractArr['start_date'] = date('Y-m-d', strtotime($_POST['start_date'])); $contractArr['end_date'] = date('Y-m-d', strtotime($_POST['end_date'])); $contractArr['contract_date'] = date('Y-m-d', strtotime($_POST['contract_date']));
<?php session_start(); require_once "../model/Backend.php"; $model = new Backend(); $url = "../index.php?mod=state&act=list"; $arrParam['state_name'] = $model->processData($_POST['state_name']); $arrParam['state_alias'] = $model->changeTitle($arrParam['state_name']); $arrParam['city_id'] = $city_id = (int) $_POST['city_id']; $state_id = (int) $_POST['state_id']; $arrParam['display_order'] = $model->getOrderMaxState("state", $city_id); $table = "state"; if ($state_id > 0) { $arrParam['id'] = $state_id; $model->update($table, $arrParam); } else { $model->insert($table, $arrParam); } header('location:' . $url . "&city_id=" . $city_id);
$meta_title = $cate_name; } if ($meta_description == '') { $meta_description = $cate_name; } if ($meta_keyword == '') { $meta_keyword = $cate_name; } $dataArr['meta_title'] = $meta_title; $dataArr['meta_description'] = $meta_description; $dataArr['meta_keyword'] = $meta_keyword; $image_url_upload = $_FILES['image_url_upload']; if ($image_url_upload['name'] != '') { $arrRe = $model->uploadImages($image_url_upload); $image_url = $arrRe['filename']; } else { $image_url = str_replace('../', '', $_POST['image_url']); } $dataArr['image_url'] = $image_url; $description = $model->processData($_POST['description']); $dataArr['description'] = $description; $seo_text = mysql_real_escape_string($_POST['seo_text']); $dataArr['seo_text'] = $seo_text; if ($id > 0) { $dataArr['id'] = $id; $model->update('article_cate', $dataArr); header('location:' . $url); } else { $model->insert('article_cate', $dataArr); header('location:' . $url); }
<?php require_once "backend/model/Backend.php"; $model = new Backend(); for ($i = 0; $i < 10; $i++) { $sql = "SELECT * FROM product"; $rs = mysql_query($sql); while ($row = mysql_fetch_assoc($rs)) { $id = $row['id']; $rs1 = mysql_query("SELECT * FROM product_cate WHERE product_id = {$id}"); while ($row1 = mysql_fetch_assoc($rs1)) { $arrCateId[$row1['cate_id']] = $row1['cate_id']; $arrParentId[$row1['cate_id']] = $row1['parent_id']; } unset($row['id']); $arrData = $row; $table = "product"; $product_id = $model->insert($table, $arrData); } }
$model->insertProductCate($arrCate, $id); $arrTmp = array(); if ($str_image) { $arrTmp = explode(';', $str_image); } if (!empty($arrTmp)) { foreach ($arrTmp as $url1) { if ($url1) { $url_1 = str_replace('.', '_2.', $url1); mysql_query("INSERT INTO images VALUES(null,'{$url1}','{$url_1}',{$id},1,1)") or die(mysql_error() . $sql); } } } header('location:' . $url); } else { $id = $model->insert($table, $arr); $model->insertProductCate($arrCate, $id); $arrTmp = array(); if ($str_image) { $arrTmp = explode(';', $str_image); } if (!empty($arrTmp)) { foreach ($arrTmp as $url) { if ($url) { $url_1 = str_replace('.', '_2.', $url); mysql_query("INSERT INTO images VALUES(null,'{$url}','{$url_1}',{$id},1,1)") or die(mysql_error()); } } } } header('location:' . $url);
$arrDoanhThu['month'] = $month = (int) $_POST['month']; $arrDoanhThu['year'] = $year = (int) $_POST['year']; $arrDoanhThu['tien_phai_thu'] = $tien_phai_thu = str_replace(',', '', $_POST['tien_phai_thu']); $arrDoanhThu['tien_nhan'] = $tien_nhan = str_replace(',', '', $_POST['tien_nhan']); $arrDoanhThu['cong_no'] = $cong_no = str_replace(',', '', $_POST['cong_no']); $arrDoanhThu['user_id'] = $user_id; $arrDoanhThu['created_at'] = time(); $arrDoanhThu['updated_at'] = time(); //process doanh thu if (isset($_POST['doanhthu_id']) && $_POST['doanhthu_id'] > 0) { $doanhthu_id = $_POST['doanhthu_id']; $arrDoanhThu['id'] = $doanhthu_id; $model->update('doanh_thu', $arrDoanhThu); mysql_query("DELETE FROM contract_service_month WHERE doanhthu_id = {$doanhthu_id}"); } else { $doanhthu_id = $model->insert('doanh_thu', $arrDoanhThu); } //process tien thue phong $arrContractServiceMonth = array(); $arrContractServiceMonth['doanhthu_id'] = $doanhthu_id; $arrContractServiceMonth['service_id'] = 9999; $arrContractServiceMonth['chi_so_cu'] = 0; $arrContractServiceMonth['chi_so_moi'] = 0; $arrContractServiceMonth['type'] = 1; $arrContractServiceMonth['price'] = $price_thue_phong; $arrContractServiceMonth['total_price'] = $price_thue_phong; $arrContractServiceMonth['amount'] = 1; $model->insert('contract_service_month', $arrContractServiceMonth); // process service chi so $arrCu = $_POST['chi_so_cu']; $arrMoi = $_POST['chi_so_moi'];
$numCol = $data->colcount(); $rowCol = $data->rowcount(); for ($j = 1; $j <= $numCol; $j++) { for ($i = 2; $i < $rowCol; $i++) { $dataArr[$arrColumn[$j - 1]][] = $data->val($i, $j); } } } if (!empty($dataArr)) { $count = count($dataArr['product_code']); for ($k = 0; $k <= $count; $k++) { foreach ($arrColumn as $value) { $dataInsert[$value] = $dataArr[$value][$k]; $dataInsert['name_en'] = $model->stripUnicode($dataArr['product_name'][$k]); $dataInsert['product_alias'] = $model->changeTitle($dataArr['product_name'][$k]); $id = $model->getProductIdByCode($dataArr['product_code'][$k]); if ($id > 0) { $dataInsert['id'] = $id; } } if ($dataInsert['product_code'] != '' && $dataInsert['product_name'] != '' && $dataInsert['cate_type_id'] != '' && $dataInsert['cate_id'] != '') { if ($dataInsert['id'] > 0) { $model->update('product', $dataInsert); echo "Cập nhật thành công sản phẩm '" . $dataInsert['product_name'] . "'" . "<br />"; } else { $model->insert('product', $dataInsert); echo "Thêm mới thành công sản phẩm '" . $dataInsert['product_name'] . "'" . "<br />"; } } } }
} else { $image_url = str_replace('../', '', $_POST['image_url']); } $dataArr['image_url'] = $image_url; $meta_title = $model->processData($_POST['meta_title']); $seo_title = $model->processData($_POST['seo_title']); $dataArr['seo_title'] = $seo_title; $meta_keyword = $model->processData($_POST['meta_keyword']); $meta_description = $model->processData($_POST['meta_description']); if ($meta_title == '') { $meta_title = $page_name; } if ($meta_keyword == '') { $meta_keyword = $page_name; } if ($meta_description == '') { $meta_description = $page_name; } $dataArr['meta_title'] = $meta_title; $dataArr['meta_keyword'] = $meta_keyword; $dataArr['meta_description'] = $meta_description; $dataArr['updated_at'] = time(); if ($id > 0) { $dataArr['id'] = $id; $model->update('articles', $dataArr); header('location:' . $url . "&cate_id=" . $cate_id); } else { $dataArr['created_at'] = time(); $model->insert('articles', $dataArr); header('location:' . $url . "&cate_id=" . $cate_id); }
$meta_keyword_en = $name_en; } $arrData['meta_title_vi'] = $meta_title_vi; $arrData['meta_title_en'] = $meta_title_en; $arrData['meta_description_vi'] = $meta_description_vi; $arrData['meta_description_en'] = $meta_description_en; $arrData['meta_keyword_vi'] = $meta_keyword_vi; $arrData['meta_keyword_en'] = $meta_keyword_en; $table = "product"; if ($id > 0) { $arrData['id'] = $id; $arrData['updated_at'] = time(); $model->update($table, $arrData); } else { $arrData['created_at'] = time(); $arrData['updated_at'] = time(); $id = $model->insert($table, $arrData); } mysql_query("DELETE FROM product_cate WHERE product_id = {$id}"); if (!empty($cateIdArr)) { foreach ($cateIdArr as $cate_id_str) { $tmp = explode("-", $cate_id_str); $parent_id_a = $tmp[0]; $cate_id = $tmp[1]; $arrDataCate['cate_id'] = $cate_id; $arrDataCate['product_id'] = $id; $arrDataCate['parent_id'] = $parent_id_a; $model->insert('product_cate', $arrDataCate); } } header('location:' . $list_url . "&cate_type_id=" . $cate_type_id);
$arrRe = $model->uploadImages($icon_url_upload); $icon_url = $arrRe['filename']; } else { $icon_url = str_replace('../', '', $_POST['icon_url']); } $arrData['icon_url'] = $icon_url; if ($id > 0) { $arrData['id'] = $id; $model->update('cate', $arrData); $url_id = $model->getUrlId($id, 1); // 1 : cate if ($url_id > 0) { $model->updateAlias($url_id, $cate_alias); } else { $model->insertAlias($cate_alias, $id, 1); } $model->updateCate($id, $cate_name, $cate_alias, $parent_id, $cate_type_id, $image_url, $icon_url, $content, $is_hot, $display_order, $meta_title, $meta_description, $meta_keyword, $hidden, $seo_text, $seo_title); if ($parent_id > 0) { header('location:../index.php?mod=cate&act=list-child&parent_id=' . $parent_id); } else { header('location:' . $url . '&cate_type_id=' . $cate_type_id); } } else { $id = $model->insert('cate', $arrData); $model->insertAlias($cate_alias, $id, 1); if ($parent_id > 0) { header('location:../index.php?mod=cate&act=list-child&parent_id=' . $parent_id); } else { header('location:' . $url . '&cate_type_id=' . $cate_type_id); } }