$customerArr['name'] = $model->processData($_POST['name']); if ($customerArr['name'] != '') { $customerArr['gender'] = (int) $_POST['gender']; $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'];
<?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);
$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 $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);
} $arr['meta_title'] = $meta_title; $arr['meta_description'] = $meta_description; $arr['meta_keyword'] = $meta_keyword; $arr['image_url'] = $image_url = str_replace('../', '', $_POST['image_url']); $arr['video_url'] = $video_url = $_POST['video_url']; $str_image = $_POST['str_image']; //san pham cung loai if (isset($_POST['sprelate']) && count($_POST['sprelate']) > 0) { $arr['product_relate'] = implode(',', $_POST['sprelate']); } else { $arr['product_relate'] = null; } if ($id > 0) { $arr['id'] = $id; $model->update($table, $arr); $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 {
<?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);
$user_id = $_SESSION['user_id']; $price_thue_phong = str_replace(",", "", $_POST['price']); $arrDoanhThu['contract_id'] = $contract_id = (int) $_POST['contract_id']; $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);
<?php require_once dirname(__FILE__) . '/../Backend.class.php'; $be = new Backend(); print_r($be->add('test', __DIR__ . '/scripts/test.php', array('writelog' => TRUE))); print_r($be->update('test', array('guard' => TRUE))); print_r($be->start('test')); // 在系统中 kill 该进程,过1分钟后查看到进程自动恢复
<?php require_once dirname(__FILE__) . '/../Backend.class.php'; $be = new Backend(); print_r($be->add('test', __DIR__ . '/scripts/test.php')); print_r($be->update('test', array('autostart' => TRUE))); /* restart your server and you will see the result below Array ( [code] => OK [data] => UP ) */ print_r($be->status('test'));
$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); }
$arrRe = $model->uploadImages($image_url_upload); $image_url = $arrRe['filename']; } else { $image_url = str_replace('../', '', $_POST['image_url']); } $arrData['image_url'] = $image_url; if ($icon_url_upload['name'] != '') { $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);