if ($use_image) { $myform->add('use_image', 'use_image', 0, 0, ''); //upload ảnh module_upload_picture($use_image); } $db_insert = new db_execute_return(); $last_id = $db_insert->db_execute($myform->generate_insert_SQL()); unset($db_insert); //log action log_action(ACTION_LOG_ADD, 'Thêm mới bản ghi ' . $last_id . ' bảng ' . $bg_table); redirect('index.php'); } break; case 'edit_record': $record_id = getValue('record_id', 'int', 'POST', 0); $myform = new generate_form(); $myform->addTable($bg_table); /* code something */ $myform->add('use_name', 'use_name', 0, 0, '', 1, 'Bạn chưa nhập tên nhân viên'); $myform->add('use_address', 'use_address', 0, 0, '', 1, 'Bạn chưa nhập địa chỉ nhân viên'); $myform->add('use_phone', 'use_phone', 0, 0, '', 0, ''); $myform->add('use_pay', 'use_pay', 1, 0, '', 0, ''); $myform->add('use_discount', 'use_discount', 1, 0, '', 0, ''); $myform->add('use_group_id', 'use_group_id', 1, 0, '', 0, ''); $myform->add('use_code', 'use_code', 0, 0, '', 0, ''); $myform->add('use_note', 'use_note', 0, 0, '', 0, ''); $bg_errorMsg .= $myform->checkdata(); // add_error_msg('Chưa nhập tên nv'); if (!$myform->checkdata()) { $use_image = getValue('use_image', 'str', 'POST', ''); if ($use_image) {
while ($row = mysqli_fetch_assoc($db_query->result)) { $array_section[$row['sec_id']] = $row['sec_name']; $db_child = new db_query('SELECT * FROM sections WHERE sec_parent_id = ' . $row['sec_id'] . ' ORDER BY sec_id ASC'); while ($row_child = mysqli_fetch_assoc($db_child->result)) { $array_section[$row_child['sec_id']] = ' - ' . $row_child['sec_name']; } } //danh sách danh mục hỏi đáp $array_cat_hoidap = array(); $db_query = new db_query('SELECT * FROM categories WHERE cat_type = ' . CATEGORY_TYPE_HOIDAP); while ($row = mysqli_fetch_assoc($db_query->result)) { $array_cat_hoidap[$row['cat_id']] = $row['cat_name']; } unset($db_query); #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $myform->add('cdi_name', 'cdi_name', 0, 0, '', 1, 'Bạn chưa nhập tên bệnh'); $myform->add('cdi_name_alias', 'cdi_name_alias', 0, 0, ''); $myform->add('cdi_tag', 'cdi_tag', 0, 0, ''); $myform->add('cdi_body_system', 'cdi_body_system', 1, 0, 0); $myform->add('cdi_popular', 'cdi_popular', 1, 0, 0); $myform->add('cdi_truyen_nhiem', 'cdi_truyen_nhiem', 1, 0, 0); $form_redirect = getValue('form_redirect', 'str', 'POST', ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg = $myform->checkdata();
require_once "inc_security.php"; checkPermission('edit'); $returnurl = base64_decode(getValue("url", "str", "GET", base64_encode("listing.html"))); $errorMsg = ''; $errorMsgAll = ""; $iQuick = getValue("iQuick", "str", "POST", ""); $record_id = getValue("record_id", "arr", "POST", ""); if (!$record_id) { redirect('listing.html'); } if ($iQuick == 'update') { $total_record = count($record_id); if ($total_record > 0) { for ($i = 0; $i < $total_record; $i++) { //Call Class generate_form(); $myform = new generate_form(); //Insert to database $myform->add('cat_name', "cat_name" . $record_id[$i], 0, 0, '', 0, '', 0, ''); $myform->add('cat_order', "cat_order" . $record_id[$i], 1, 0, '', 0, '', 0, ''); //Add table $myform->addTable($bg_table); $errorMsg .= $myform->checkdata($id_field, $record_id[$i]); //Check loi cua tat ca cac ban ghi duoc sua $errorMsgAll .= $errorMsg; if ($errorMsg == "") { $db_ex = new db_execute($myform->generate_update_SQL($id_field, $record_id[$i])); unset($db_ex); } else { echo $record_id[$i] . " : " . $errorMsg . "</br>"; } unset($myform);
<?php require_once 'inc_security.php'; checkPermission('add'); #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); $myform->add('cit_name', 'cit_name', 0, 0, '', 1, 'Bạn chưa nhập tên tỉnh - thành phố'); $myform->add('cit_tw', 'cit_tw', 1, 0, ''); $myform->add('cit_static_fee', 'cit_static_fee', 1, 0, ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg = $myform->checkdata(); if (!$bg_errorMsg) { $db_insert = new db_execute_return(); $last_id = $db_insert->db_execute($myform->generate_insert_SQL()); //insert quận huyện nếu có $array_district = getValue('array_district', 'arr', 'POST', ''); if ($array_district) { $sql_district = 'INSERT INTO ' . $bg_table_district . '(dis_city_id,dis_name) VALUES'; foreach ($array_district as $district) { if (!$district) { continue; } $district = remove_magic_quote($district); $district = removeScript($district); $district = removeHTML($district); $sql_district .= '(' . $last_id . ',"' . $district . '"),'; } $sql_district = rtrim($sql_district, ','); //insert
<?php require 'inc_security.php'; $record_id = getValue('record_id'); $listGender = array(); $listGender[0] = '-- Giới tính --'; $listGender[1] = 'Nam'; $listGender[2] = 'Nữ'; $listGender[3] = 'Khác'; $use_birthday = getValue('use_birthday', 'str', 'POST', ''); $use_birthday = convertDateTime($use_birthday); $myform = new generate_form(); $myform->removeHTML(0); $myform->add('use_email', 'use_email', 0, 0, '', 1, 'Lỗi nhập email', 0, 'Trùng email'); $myform->add('use_name', 'use_email', 0, 0, '', 1, 'Lỗi nhập email', 0, 'Trùng email'); $myform->add('use_firstname', 'use_firstname', 0, 0, '', 1, 'Bạn chưa nhập họ', 0); $myform->add('use_lastname', 'use_lastname', 0, 0, '', 1, 'Bạn chưa nhập tên', 0); $myform->add('use_birthday', 'use_birthday', 0, 1, '', 1, 'Bạn chưa nhập ngày sinh', 0); $myform->add('use_phone', 'use_phone', 1, 0, 0, 1, 'Bạn chưa nhập số điện thoại', 0); $myform->add('use_contact', 'use_contact', 0, 0, '', 1, 'Bạn chưa nhập địa chỉ', 0); $myform->add('use_gender', 'use_gender', 1, 0, 0, 0, '', 0, ''); $myform->add('use_date', 'use_date', 1, 1, 0, 0, '', 0, ''); $myform->add('use_active', 'use_active', 1, 0, 0, 0, '', 0, ''); $myform->add('use_group', 'use_group', 1, 1, 0, 0, '', 0, ''); $myform->removeHTML(0); $myform->addTable($bg_table); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg .= $myform->checkdata(); $upload = new upload('use_avatar', $bg_filepath, $bg_extension, $limit_size); $filename = $upload->file_name;
$myform->add('new_lin_id', 'link_id', 1, 1, $link_id); $myform->add('new_picture', 'image', 0, 1, $image); $myform->add('new_teaser', 'teaser', 0, 1, $teaser); $myform->add('new_tags', 'tag_string', 0, 1, $tag_string); $myform->add('new_date', 'time', 1, 1, $time); $myform->add('new_active', 'active', 1, 1, $active); $myform->removeHTML(0); if (!$myform->checkdata()) { $db_execute_return = new db_execute_return(); $last_id = $db_execute_return->db_execute($myform->generate_insert_SQL()); unset($db_execute_return); if ($last_id) { //cập nhật link lấy thành công $db_update = new db_execute('UPDATE links SET lin_status = ' . LINK_STATUS_SUCCESS . ' WHERE lin_id = ' . $link_id); //insert content vào bảng news detail $myform2 = new generate_form(); $myform2->addTable('news_detail'); $myform2->add('ndt_id', 'last_id', 1, 1, 0, 1, 'Không có ID bài viết'); $myform2->add('ndt_content', 'content', 0, 1, '', 1, 'Content trống'); $myform2->removeHTML(0); if (!$myform2->checkdata()) { $db_insert = new db_execute($myform2->generate_insert_SQL()); unset($db_insert); echo 'Lấy thành công tin : <a href="' . $link_url . '">' . $link_url . '</a>'; reload(30); die; } else { $db_update = new db_execute('UPDATE links SET lin_status = ' . LINK_STATUS_FAIL . ' WHERE lin_id = ' . $link_id); echo 'Dữ liệu trống'; reload(30); die;
<? require_once("inc_security.php"); //Call Class generate_form(); $myform = new generate_form(); //Loại bỏ chuc nang thay the Tag Html $myform->removeHTML(0); //array chua cac truong ko update $arrayFieldNotUpdate = "'con_id','con_lang_id','con_mod_rewrite'"; $db_config = new db_query("SELECT * FROM configuration WHERE con_lang_id = " . $lang_id); $row = mysql_fetch_array($db_config->result); //array list update $arrayField = array( // 1 ten truong, 2 kieu, 3 gia tri mac dinh, 4 chieu rong, 5 tieu de array("con_site_title",0,1000,90,"Page title","text") ,array("con_admin_email",0,1000,90,"Email Admin","text") # ,array("con_page_size",1,1000,10,"Page width size","text") # ,array("con_left_size",1,1000,10,"Cột trái","text") # ,array("con_percent",1,40,10,"Phần trăm title","text") //,array("con_currency",0,180,10,"Tiền tệ mặc định","text") //,array("con_list_currency",0,1000,90,"Các kiểu tiền tệ","text") //,array("con_support_online",0,180,90,"Hỗ trợ trực tuyến","textarea") ,array("con_meta_description",0,180,90,translate_text("Page_infomation"),"textarea") ,array("con_meta_keywords",0,180,90,translate_text("Google_keyword"),"textarea") ,array("con_help_visitor",0,0,30,"Visitor","text") ,array("con_admin_email",0,0,30,"Email web","text") ,array("con_help_product_model",0,0,30,"Model","text") ,array("con_help_online_trading",0,0,30,"Giao dịch online / ngày","text") ,array("con_phone_1",0,0,30,"Hỗ trợ chung","text") ,array("con_phone_2",0,0,30,"Hotline","text")
$cus_picture = getValue('cus_picture', 'str', 'POST', ''); if ($cus_picture) { module_upload_picture($cus_picture); $myform->add('cus_picture', 'cus_picture', 0, 0, ''); } $db_insert = new db_execute_return(); $last_id = $db_insert->db_execute($myform->generate_insert_SQL()); unset($db_insert); //log action log_action(ACTION_LOG_ADD, 'Thêm mới bản ghi ' . $last_id . ' bảng ' . $bg_table); redirect('index.php'); } break; case 'edit_record': $record_id = getValue('record_id', 'int', 'POST', 0); $myform = new generate_form(); $myform->addTable($bg_table); /* code something */ $myform->add('cus_name', 'cus_name', 0, 0, '', 1, 'Bạn chưa nhập tên khách hàng'); $myform->add('cus_address', 'cus_address', 0, 0, '', 1, 'Bạn chưa nhập địa chỉ'); $myform->add('cus_phone', 'cus_phone', 0, 0, '', 0, ''); $myform->add('cus_email', 'cus_email', 0, 0, '', 1, ''); $myform->add('cus_cat_id', 'cus_cat_id', 1, 0, '', 0, ''); $myform->add('cus_code', 'cus_code', 0, 0, '', 0, ''); $myform->add('cus_note', 'cus_note', 0, 0, '', 0, ''); $bg_errorMsg .= $myform->checkdata(); if (!$myform->checkdata()) { $cus_picture = getValue('cus_picture', 'str', 'POST', ''); if ($cus_picture) { $myform->add('cus_picture', 'cus_picture', 0, 0, ''); //upload ảnh
<?php require 'config_security.php'; $bg_errorMsg = ''; $bg_table = 'navigate_admin'; //array module $array_module = array(); $db_query = new db_query('SELECT mod_id, mod_name FROM modules ORDER BY mod_id ASC'); while ($row = mysqli_fetch_assoc($db_query->result)) { $array_module[$row['mod_id']] = $row['mod_name']; } check_super_admin(); #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); $myform->add('nav_name', 'nav_name', 0, 0, '', 1); $myform->add('nav_module_id', 'nav_module_id', 1, 0, 1); $myform->add('nav_order', 'nav_order', 1, 0, 1); /** * Something here ... * insert, update... */ $form_redirect = getValue('form_redirect', 'str', 'POST', ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg = $myform->checkdata(); /** * something code here */ if (!$bg_errorMsg) { $db_insert = new db_execute_return();
} unset($db_query); $list_checkbox_dotuoi = array(); foreach ($array_do_tuoi as $key => $value) { $list_checkbox_dotuoi[] = array('name' => 'cdi_do_tuoi[]', 'id' => 'cdi_do_tuoi' . $key, 'value' => $key, 'label' => $value); } $list_checkbox_doituong = array(); foreach ($array_doi_tuong as $key => $value) { $list_checkbox_doituong[] = array('name' => 'cdi_doi_tuong[]', 'id' => 'cdi_doi_tuong' . $key, 'value' => $key, 'label' => $value); } $list_checkbox_mua = array(); foreach ($array_theo_mua as $key => $value) { $list_checkbox_mua[] = array('name' => 'cdi_theo_mua[]', 'id' => 'cdi_theo_mua' . $key, 'value' => $key, 'label' => $value); } #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $myform->add('cdi_name', 'cdi_name', 0, 0, '', 1, 'Bạn chưa nhập tên bệnh', 1, 'Bệnh đã tồn tại'); $myform->add('cdi_name_alias', 'cdi_name_alias', 0, 0, ''); $myform->add('cdi_tag', 'cdi_tag', 0, 0, ''); $myform->add('cdi_body_system', 'cdi_body_system', 1, 0, 0); $myform->add('cdi_popular', 'cdi_popular', 1, 0, 0); $myform->add('cdi_truyen_nhiem', 'cdi_truyen_nhiem', 1, 0, 0); $form_redirect = getValue('form_redirect', 'str', 'POST', ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $cdi_sec_id = getValue('cdi_sec_id', 'arr', 'POST', array());
<?php require_once 'inc_security.php'; checkPermission('add'); //danh sách vùng bộ phận $array_section = array(); $db_query = new db_query('SELECT * FROM sections WHERE sec_parent_id = 0 ORDER BY sec_id ASC'); while ($row = mysqli_fetch_assoc($db_query->result)) { $array_section[$row['sec_id']] = $row['sec_name']; $db_child = new db_query('SELECT * FROM sections WHERE sec_parent_id = ' . $row['sec_id'] . ' ORDER BY sec_id ASC'); while ($row_child = mysqli_fetch_assoc($db_child->result)) { $array_section[$row_child['sec_id']] = ' - ' . $row_child['sec_name']; } } #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $myform->add('ana_sec_id', 'ana_sec_id', 1, 0, 0, 1, 'Bạn chưa chọn bộ phận'); $myform->add('ana_title', 'ana_title', 0, 0, ''); $myform->add('ana_alt', 'ana_alt', 0, 0, ''); $myform->add('ana_coords', 'ana_coords', 0, 0, '', 1, 'Bạn chưa nhập tọa độ'); $myform->add('ana_type', 'ana_type', 1, 0, 0); $myform->add('ana_sex', 'ana_sex', 1, 0, 0); $form_redirect = getValue('form_redirect', 'str', 'POST', ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg = $myform->checkdata();
<?php require_once 'inc_security.php'; checkPermission('edit'); $record_id = getValue('record_id'); #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $myform->add('cat_name', 'cat_name', 0, 0, '', 1, 'Bạn chưa nhập tên danh mục'); $myform->add('cat_type', 'cat_type', 1, 0, 0, 0); $myform->add('cat_title', 'cat_title', 0, 0, ''); $form_redirect = getValue('form_redirect', 'str', 'POST', ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg = $myform->checkdata(); /** * something code here */ if (!$bg_errorMsg) { $cat_picture = getValue('cat_picture', 'str', 'POST', ''); if ($cat_picture) { $myform->add('cat_picture', 'cat_picture', 0, 1, ''); $path_upload = '../../..' . get_picture_dir($cat_picture) . '/' . $cat_picture; rename('../../../temp/' . $cat_picture, $path_upload); } $db_update = new db_execute($myform->generate_update_SQL($id_field, $record_id)); unset($db_update);
module_upload_picture($sup_image); $myform->add('sup_image', 'sup_image', 0, 0, ''); } $db_insert = new db_execute_return(); $last_id = $db_insert->db_execute($myform->generate_insert_SQL()); unset($db_insert); //log action if ($last_id) { log_action(ACTION_LOG_ADD, 'Thêm mới bản ghi ' . $last_id . ' bảng ' . $bg_table); } redirect('index.php'); } break; case 'edit_record': $record_id = getValue('record_id', 'int', 'POST', 0); $myform = new generate_form(); $myform->addTable($bg_table); /* code something */ $myform->add('sup_name', 'sup_name', 0, 0, '', 1, 'Bạn chưa nhập tên nhà cung cấp'); $myform->add('sup_address', 'sup_address', 0, 0, '', 1, 'Bạn chưa nhập địa chỉ nhà cung cấp'); $myform->add('sup_phone', 'sup_phone', 0, 0, '', 0, ''); $myform->add('sup_mobile', 'sup_mobile', 0, 0, '', 0, ''); $myform->add('sup_fax', 'sup_fax', 0, 0, '', 0, ''); $myform->add('sup_email', 'sup_email', 0, 0, '', 0, ''); $myform->add('sup_website', 'sup_website', 0, 0, '', 0, ''); $myform->add('sup_cat_id', 'sup_cat_id', 1, 0, '', 0, ''); if (!$myform->checkdata()) { $db_insert = new db_execute($myform->generate_update_SQL($id_field, $record_id)); //upload image $sup_image = getValue('sup_image', 'str', 'POST', ''); if ($sup_image) {
<?php require_once 'inc_security.php'; checkPermission('edit'); $record_id = getValue('record_id'); $hcq = array('' => ' -- Hệ cơ quan --'); $array_he_co_quan = $hcq + $array_he_co_quan; $group_section = array(0 => ' -- Chọn nhóm bộ phận --'); $db_query = new db_query('SELECT sec_id,sec_name FROM sections WHERE sec_parent_id = 0'); while ($row = mysqli_fetch_assoc($db_query->result)) { $group_section[$row['sec_id']] = $row['sec_name']; } #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $myform->add('sec_name', 'sec_name', 0, 0, '', 1, 'Bạn chưa nhập tên bộ phận'); $myform->add('sec_parent_id', 'sec_parent_id', 1, 0, 0, 0, ''); $myform->add('sec_type', 'sec_type', 1, 0, 0); $myform->add('sec_body_system', 'sec_body_system', 1, 0, 0); $myform->add('sec_desc', 'sec_desc', 0, 0, ''); $form_redirect = getValue('form_redirect', 'str', 'POST', ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg = $myform->checkdata(); /** * something code here */
$sql_store = 'INSERT INTO product_quantity (product_id, store_id, pro_quantity) VALUES'; foreach ($list_stores as $store) { $sql_store .= '(' . $last_id . ',' . $store['cat_id'] . ',0),'; } $sql_store = rtrim($sql_store, ','); $db_store = new db_execute($sql_store); unset($db_store); //log action log_action(ACTION_LOG_ADD, 'Thêm mới bản ghi ' . $last_id . ' bảng ' . $bg_table); redirect('index.php'); } break; case 'edit_record': $record_id = getValue('record_id', 'int', 'POST', 0); $myform = new generate_form(); $myform->addTable($bg_table); /* code something */ $myform->add('pro_name', 'pro_name', 0, 0, '', 1, 'Bạn chưa nhập tên thực đơn'); $myform->add('pro_unit_id', 'pro_unit_id', 1, 0, '', 1, 'Bạn chưa nhập đơn vị tính'); $myform->add('pro_cat_id', 'pro_cat_id', 1, 0, '', 0, ''); $myform->add('pro_instock', 'pro_instock', 1, 0, '', 0, ''); $myform->add('pro_code', 'pro_code', 0, 0, '', 0, ''); $myform->add('pro_note', 'pro_note', 0, 0, '', 0, ''); if (!$myform->checkdata()) { $pro_image = getValue('pro_image', 'str', 'POST', ''); if ($pro_image) { module_upload_picture($pro_image); $myform->add('pro_image', 'pro_image', 0, 0, ''); } $db_insert = new db_execute($myform->generate_update_SQL($id_field, $record_id));
<? include("config_security.php"); ?> <? $record_id = getValue("record_id", "arr", "POST", array()); $field_id = "mod_id"; $fs_table = "modules"; //Warning Error! $errorMsg = ""; //Get Action. //Call Class generate_form(); $myform = new generate_form(); //Loại bỏ chuc nang thay the Tag Html //$myform->removeHTML(0); //Check Error! $myform->add("mod_name","mod_name",0,0,"",0,"",0,"Bạn chưa nhập tiêu đề bài viết"); $myform->add("mod_path","mod_path",0,0,"",0,"",0,""); $myform->add("mod_listname","mod_listname",0,0,"",0,"",0,""); $myform->add("mod_listfile","mod_listfile",0,0,"",0,"",0,""); $myform->add("mod_order","mod_order",1,0,0,0,"",0,"Bạn chưa nhập ngày đăng tin"); //Add table $myform->addTable($fs_table); $iQuick = getValue("iQuick","str","POST",""); if ($iQuick == "update"){ $errorMsg=''; $errorMsg .= $myform->checkdata(); if($errorMsg == ""){ //echo $myform->generate_insert_SQL(); $db_ex = new db_execute($myform->generate_insert_SQL()); unset($db_ex); //Hien thi loi
<?php require_once 'inc_security.php'; checkPermission('add'); #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $myform->add('new_title', 'new_title', 0, 0, '', 1, 'Bạn chưa nhập tiêu đề'); $myform->add('new_active', 'new_active', 1, 0, 0, 0); $form_redirect = getValue('form_redirect', 'str', 'POST', ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg = $myform->checkdata(); /** * something code here */ if (!$bg_errorMsg) { //update ảnh $new_picture = getValue('new_picture', 'str', 'POST', ''); if ($new_picture) { $myform->add('new_picture', 'new_picture', 0, 1, ''); //move ảnh $path_upload = '../../..' . get_picture_dir($new_picture) . '/' . $new_picture; rename('../../../temp/' . $new_picture, $path_upload); } $db_insert = new db_execute_return(); $last_id = $db_insert->db_execute($myform->generate_insert_SQL());
<?php require_once 'inc_security.php'; checkPermission('edit'); $record_id = getValue('record_id'); #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $myform->add('cit_name', 'cit_name', 0, 0, '', 1, 'Bạn chưa nhập tên'); $form_redirect = getValue('form_redirect', 'str', 'POST', ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg = $myform->checkdata(); /** * something code here */ if (!$bg_errorMsg) { $db_update = new db_execute($myform->generate_update_SQL($id_field, $record_id)); unset($db_update); /** * something code here */ //redirect redirect($form_redirect); } } //lấy dữ liệu record cần sửa đổi
require 'inc_security.php'; $listGender = array(); $listGender[0] = '-- Giới tính --'; $listGender[1] = 'Nam'; $listGender[2] = 'Nữ'; $listGender[3] = 'Khác'; $use_date = time(); $pass = getValue("use_password", "str", "POST", "", 1); $use_security = rand(111111, 999999); $use_password = md5($pass . $use_security); $use_birthday = getValue('use_birthday', 'str', 'POST', ''); $use_birthday = convertDateTime($use_birthday); $use_date = time(); $use_group = 1; $myform = new generate_form(); $myform->removeHTML(0); $myform->add('use_email', 'use_email', 0, 0, '', 1, 'Lỗi nhập email', 1, 'Trùng email'); $myform->add('use_name', 'use_email', 0, 0, '', 1, 'Lỗi nhập email', 1, 'Trùng email'); $myform->add('use_password', 'use_password', 0, 1, '', 1, 'Bạn chưa nhập mật khẩu.', 0, ''); $myform->add('use_firstname', 'use_firstname', 0, 0, '', 1, 'Bạn chưa nhập họ', 0); $myform->add('use_lastname', 'use_lastname', 0, 0, '', 1, 'Bạn chưa nhập tên', 0); $myform->add('use_birthday', 'use_birthday', 0, 1, '', 1, 'Bạn chưa nhập ngày sinh', 0); $myform->add('use_phone', 'use_phone', 1, 0, 0, 1, 'Bạn chưa nhập số điện thoại', 0); $myform->add('use_contact', 'use_contact', 0, 0, '', 1, 'Bạn chưa nhập địa chỉ', 0); $myform->add('use_gender', 'use_gender', 1, 0, 0, 0, '', 0, ''); $myform->add('use_date', 'use_date', 1, 1, 0, 0, '', 0, ''); $myform->add('use_security', 'use_security', 1, 1, '', 0, '', 0, ''); $myform->add('use_active', 'use_active', 1, 0, 0, 0, '', 0, ''); $myform->add('use_group', 'use_group', 1, 1, 0, 0, '', 0, ''); $myform->addTable($bg_table);
<?php require_once 'inc_security.php'; checkPermission('add'); #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $myform->add('pha_name', 'pha_name', 0, 0, '', 1); $myform->add('pha_title', 'pha_title', 0, 0, '', 1); $myform->add('pha_description', 'pha_description', 0, 0, '', 0); $myform->add('pha_content', 'pha_content', 0, 0, '', 0); $myform->add('pha_so_dang_ky', 'pha_so_dang_ky', 0, 0, '', 1); $myform->add('pha_dang_bao_che', 'pha_dang_bao_che', 0, 0, '', 0); $myform->add('pha_dong_goi', 'pha_dong_goi', 0, 0, '', 0); $myform->add('pha_gia_buon', 'pha_gia_buon', 0, 0, '', 0); $myform->add('pha_gia_le', 'pha_gia_le', 0, 0, '', 0); $pha_nha_sx_name = getValue('pha_nha_sx_name', 'str', 'POST', ''); $check_id_nsx = new db_query('SELECT phc_id FROM pharma_company WHERE phc_name = "' . $pha_nha_sx_name . '" LIMIT 1'); $check_id_nsx = mysqli_fetch_assoc($check_id_nsx->result); if ($check_id_nsx && $check_id_nsx['phc_id']) { $check_id_nsx = $check_id_nsx['phc_id']; $myform->add('pha_nha_sx_id', 'check_id_nsx', 1, 1, 0); } else { //insert tên công ty vào bảng pharma_company
<?php require_once 'inc_security.php'; global $isAdmin; global $admin_id; //Phần xử lý if ($isAjaxRequest) { $action = getValue('action', 'str', 'POST', '', 2); switch ($action) { case 'setup': $array_return = array(); $myform = new generate_form(); $myform->addTable($bg_table); $myform->add('con_restaurant_name', 'res_name', 0, 0, ''); $myform->add('con_restaurant_address', 'res_address', 0, 0, ''); $myform->add('con_restaurant_phone', 'res_phone', 0, 0, ''); // quay tinh tien $myform->add('con_default_svdesk', 'con_default_svdesk', 1, 0, 0); //kho hang $myform->add('con_default_store', 'con_default_store', 1, 0, 0); if (!$myform->checkdata()) { $con_picture = getValue('con_restaurant_image', 'str', 'POST', ''); if ($con_picture) { $myform->add('con_restaurant_image', 'con_restaurant_image', 0, 0, ''); //upload ảnh module_upload_picture($con_picture); } $db_update = new db_execute($myform->generate_update_SQL('con_admin_id', $admin_id)); unset($db_update); // log action log_action(ACTION_LOG_ADD, 'Cập nhật hệ thống cài đặt chung');
<?php require_once 'inc_security.php'; checkPermission('add'); #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $form_redirect = getValue('form_redirect', 'str', 'POST', ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg = $myform->checkdata(); /** * something code here */ if (!$bg_errorMsg) { $db_insert = new db_execute_return(); $last_id = $db_insert->db_execute($myform->generate_insert_SQL()); unset($db_insert); /** * something code here */ //redirect if ($last_id) { redirect($form_redirect); } } }
function ajaxedit($fs_table){ $this->edit_ajax = true; //nếu truong hợp checkbox thì chỉ thay đổi giá trị 0 và 1 thôi $checkbox = getValue("checkbox","int","GET",0); if($checkbox==1){ $record_id = getValue("record_id","int","GET",0); $field = getValue("field","str","GET","dfsfdsfdddddddddddddddd"); if(trim($field) != '' && in_array($field,$this->arrayField)){ $db_query = new db_query("SELECT " . $field . " FROM " . $fs_table . " WHERE " . $this->field_id . "=" . $record_id); if($row = mysql_fetch_assoc($db_query->result)){ $value = ($row[$field]==1) ? 0 : 1; $db_update = new db_execute("UPDATE " . $fs_table . " SET " . $field . " = " . $value . " WHERE " . $this->field_id . "=" . $record_id); unset($db_update); echo '<img src="' . $this->image_path . 'check_' . $value . '.gif" border="0">'; } unset($db_query); } exit(); } //phần sửa đổi giá trị từng trường $ajaxedit = getValue("ajaxedit","int","GET",0); $id = getValue("id","str","POST",""); $value = getValue("value","str","POST",""); $array = trim(getValue("array","str","POST","")); if($ajaxedit == 1){ $arr = explode(",",$id); $id = isset($arr[1]) ? intval($arr[1]) : 0; $field = isset($arr[0]) ? strval($arr[0]) : ''; $type = isset($arr[2]) ? intval($arr[2]) : 0; if($type == 3) $_POST["value"] = str_replace(array("."),"",$value); //print_r($_POST); if($id != 0 && in_array($field,$this->arrayField)){ $myform = new generate_form(); $myform->removeHTML(0); $myform->add($field,"value",$type,0,"",0,"",0,""); $myform->addTable($fs_table); $errorMsg = $myform->checkdata(); if($errorMsg == ""){ $db_ex = new db_execute($myform->generate_update_SQL($this->field_id,$id)); } } if($array!=''){ if(in_array($array,$this->arrayField)){ global $$array; $arr = $$array; $value = isset($arr[$value]) ? $arr[$value] : 'error'; } } echo $value; exit(); } }
<?php require_once 'inc_security.php'; checkPermission('edit'); $record_id = getValue('record_id'); #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $myform->add('new_title', 'new_title', 0, 0, '', 1, 'Bạn chưa nhập tiêu đề'); $myform->add('new_active', 'new_active', 1, 0, 0, 0); $form_redirect = getValue('form_redirect', 'str', 'POST', ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg = $myform->checkdata(); /** * something code here */ if (!$bg_errorMsg) { //update ảnh $new_picture = getValue('new_picture', 'str', 'POST', ''); if ($new_picture) { $myform->add('new_picture', 'new_picture', 0, 1, ''); //move ảnh $path_upload = '../../..' . get_picture_dir($new_picture) . '/' . $new_picture; rename('../../../temp/' . $new_picture, $path_upload); } $db_update = new db_execute($myform->generate_update_SQL($id_field, $record_id));
$myform->add('new_cat_id', 'new_cat_id', 1, 0, 0, 1); $myform->add('new_lin_id', 'new_lin_id', 1, 0, 0, 1); $myform->add('new_picture', 'new_picture', 0, 0, ''); $myform->add('new_teaser', 'new_teaser', 0, 0, '', 1); $myform->add('new_tags', 'new_tags', 0, 0, ''); $myform->add('new_date', 'new_date', 1, 0, 0, 1); $myform->add('new_active', 'new_active', 1, 0, 0, 1); if (!$myform->checkdata()) { $db_insert = new db_execute_return(); $last_id = $db_insert->db_execute($myform->generate_insert_SQL()); unset($db_insert); //lưu ảnh if ($last_id) { $path_picture = generate_dir_upload($_POST['new_picture'], 'organic') . $_POST['new_picture']; move_uploaded_file($_FILES['data_picture']['tmp_name'], $path_picture); //lưu chi tiết tin $myform_dt = new generate_form(); $myform_dt->addTable('news_detail'); $myform_dt->add('ndt_id', 'last_id', 1, 1, 0); $myform_dt->add('ndt_content', 'ndt_content', 0, 0, ''); $myform_dt->removeHTML(0); $db_insert = new db_execute($myform_dt->generate_insert_SQL()); $total = $db_insert->total; unset($db_insert); if ($total) { echo $last_id; } else { echo 0; } } }
public function openDesk() { //Phần này sẽ trả về json - khai báo biến chứa array kết quả trả về $array_return = array(); //Kiểm tra xem bàn hiện tại đã mở chưa $desk_id = getValue('desk_id', 'int', 'POST', 0); if (!$desk_id) { return; } check_desk_exist($desk_id); $db_query = new db_query('SELECT * FROM current_desk WHERE cud_desk_id = ' . $desk_id); $desk_data = mysqli_fetch_assoc($db_query->result); unset($db_query); if ($desk_data) { //Nếu bàn đang mở thì show ra $this->getCurrentDeskDetail(); return; } //nếu không thì mở bàn //khai báo các giá trị default khi mở bàn $cud_start_time = time(); $cud_note = ''; $cud_desk_id = $desk_id; //id bàn $cud_customer_id = 0; //id khách hàng $cud_staff_id = 0; //id nhân viên phục vụ $cud_extra_fee = 0; //phụ phí tính theo % $cud_vat = 0; //thuế VAT tính theo % $cud_customer_discount = 0; //giảm giá áp dụng cho loại khách $cud_debit = 0; //ghi nợ hay ko? $cud_pay_type = PAY_TYPE_CASH; //loại thanh toán là tiền mặt hay qua thẻ $array_return['cud_start_time'] = $cud_start_time; $array_return['start_time_string'] = date('d/m/Y H:i', $cud_start_time); $array_return['cud_note'] = $cud_note; $array_return['cud_desk_id'] = $cud_desk_id; $array_return['cud_customer_id'] = $cud_customer_id; $array_return['cud_staff_id'] = $cud_staff_id; $array_return['cud_extra_fee'] = $cud_extra_fee; $array_return['cud_vat'] = $cud_vat; $array_return['cud_customer_discount'] = $cud_customer_discount; $array_return['cud_debit'] = $cud_debit; $array_return['cud_pay_type'] = $cud_pay_type; $myform = new generate_form(); $myform->addTable('current_desk'); $myform->add('cud_desk_id', 'cud_desk_id', 1, 1, $cud_desk_id); $myform->add('cud_customer_id', 'cud_customer_id', 1, 1, $cud_customer_id); $myform->add('cud_staff_id', 'cud_staff_id', 1, 1, $cud_staff_id); $myform->add('cud_note', 'cud_note', 0, 1, $cud_note); $myform->add('cud_start_time', 'cud_start_time', 1, 1, $cud_start_time); $myform->add('cud_extra_fee', 'cud_extra_fee', 3, 1, $cud_extra_fee); $myform->add('cud_vat', 'cud_vat', 3, 1, $cud_vat); $myform->add('cud_customer_discount', 'cud_customer_discount', 3, 1, $cud_customer_discount); $myform->add('cud_debit', 'cud_debit', 1, 1, $cud_debit); $myform->add('cud_pay_type', 'cud_pay_type', 1, 1, $cud_pay_type); //insert to current_desk $db_execute = new db_execute($myform->generate_insert_SQL()); unset($db_execute); //lấy ra thông tin về menu mở bàn $list_menu = ''; $this->list->add('', 'Tên thực đơn'); $this->list->add('', 'ĐVT'); $this->list->add('', 'SL'); $this->list->add('', 'Đơn giá'); $this->list->add('', 'Giảm'); $this->list->add('', 'Thành tiền'); $menu_start = array(0); if ($this->start_menu) { foreach ($this->start_menu as $men_id => $men_number) { $menu_start[] = $men_id; } } $menu_start = implode(',', $menu_start); $db_count = new db_count('SELECT count(*) AS count FROM menus WHERE men_id IN(' . $menu_start . ')'); $total = $db_count->total; unset($db_count); $db_listing = new db_query('SELECT * FROM menus WHERE men_id IN(' . $menu_start . ')' . $this->list->limit($total)); $total_row = mysqli_num_rows($db_listing->result); $list_menu .= $this->list->showHeader($total_row); $i = 0; $array_unit = array(); $db_query = new db_query('SELECT * FROM units'); while ($row = mysqli_fetch_assoc($db_query->result)) { $array_unit[$row['uni_id']] = $row['uni_name']; } while ($row = mysqli_fetch_assoc($db_listing->result)) { $i++; $list_menu .= $this->list->start_tr($i, $row['men_id'], 'onclick="selectMenuInDesk(' . $row['men_id'] . ')" class="menu-normal record-item" data-record_id="' . $row['men_id'] . '"'); /* code something */ //Thành tiền - công thức tính bằng giá * (100 - %giảm giá) * số lượng $menu_item_number = $this->start_menu[$row['men_id']]; $menu_item_price = $row['men_price']; $menu_item_discount = 0; $menu_item_total = $menu_item_number * (100 - $menu_item_discount) / 100 * $menu_item_price; $list_menu .= '<td class="text-left" width="200px;">' . $row['men_name'] . '</td>'; $list_menu .= '<td class="center">' . $array_unit[$row['men_unit_id']] . '</td>'; $list_menu .= '<td class="center">' . $menu_item_number . '</td>'; $list_menu .= '<td class="text-right">' . format_number($menu_item_price) . '</td>'; //Giảm giá của menu - theo khuyến mại. hiện tại chưa có quản lý khuyến mại nên để 0 mặc định $list_menu .= '<td class="text-center">0</td>'; $list_menu .= '<td class="text-right">' . format_number($menu_item_total) . '</td>'; $list_menu .= $this->list->end_tr(); //insert thông tin về menu mở bàn vào bảng current_desk_menu $sql = 'INSERT INTO current_desk_menu(cdm_desk_id, cdm_menu_id, cdm_number, cdm_price, cdm_price_type, cdm_create_time, cdm_updated_time) VALUES (' . $desk_id . ',' . $row['men_id'] . ',' . $this->start_menu[$row['men_id']] . ',' . $row['men_price'] . ',"men_price", ' . time() . ', ' . time() . ')'; $db_insert = new db_execute($sql); unset($db_insert); } $list_menu .= $this->list->showFooter(); //log action log_action(ACTION_LOG_ADD, 'Tạo bàn ID: ' . $desk_id); $array_return['list_menu'] = $list_menu; $array_return['array_menu'] = $this->getArrayMenu($desk_id); $array_return['customer_code'] = format_codenumber($array_return['cud_customer_id'], 6, PREFIX_CUSTOMER_CODE); $array_return['customer_name'] = 'Khách lẻ'; $array_return['staff_code'] = format_codenumber($array_return['cud_staff_id'], 6, PREFIX_STAFF_CODE); $array_return['staff_name'] = 'Không chọn nhân viên'; $this->add($array_return); }
<?php require_once 'inc_security.php'; checkPermission('edit'); $record_id = getValue('record_id'); #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $myform->add('pha_name', 'pha_name', 0, 0, '', 1); $myform->add('pha_title', 'pha_title', 0, 0, '', 1); $myform->add('pha_description', 'pha_description', 0, 0, '', 0); $myform->add('pha_content', 'pha_content', 0, 0, '', 0); $myform->add('pha_so_dang_ky', 'pha_so_dang_ky', 0, 0, '', 1); $myform->add('pha_dang_bao_che', 'pha_dang_bao_che', 0, 0, '', 0); $myform->add('pha_dong_goi', 'pha_dong_goi', 0, 0, '', 0); $myform->add('pha_gia_buon', 'pha_gia_buon', 0, 0, '', 0); $myform->add('pha_gia_le', 'pha_gia_le', 0, 0, '', 0); $pha_nha_sx_name = getValue('pha_nha_sx_name', 'str', 'POST', ''); $check_id_nsx = new db_query('SELECT phc_id FROM pharma_company WHERE phc_name = "' . $pha_nha_sx_name . '" LIMIT 1'); $check_id_nsx = mysqli_fetch_assoc($check_id_nsx->result); if ($check_id_nsx && $check_id_nsx['phc_id']) { $check_id_nsx = $check_id_nsx['phc_id']; $myform->add('pha_nha_sx_id', 'check_id_nsx', 1, 1, 0); } else {
$errorMsg = ""; //Warning Error! $action = getValue("action", "str", "POST", ""); $fs_action = getURL(); $record_id = getValue("record_id"); $sta_strdate = getValue("sta_strdate", "str", "POST", date("d/m/Y")); $sta_strtime = getValue("sta_strtime", "str", "POST", date("H:i:s")); $sta_date = convertDateTime($sta_strdate, $sta_strtime); #+ checkRowUser($fs_table,$field_id,$record_id,$listing); #+ #+ Goi class generate form $myform = new generate_form(); //Call Class generate_form(); $myform->removeHTML(0); //Loại bỏ chức năng không cho điền tag html trong form #+ #+ Khai bao bang du lieu $myform->addTable($fs_table); // Add table #+ #+ Khai bao thong tin cac truong $myform->add("sta_category_id", "sta_category_id", 1, 0, 0, 1, "Bạn chưa chọn danh mục.", 0, ""); $myform->add("sta_title", "sta_title", 0, 0, "", 1, "Bạn chưa nhập tiêu đề.", 0, ""); $myform->add("sta_order", "sta_order", 1, 0, 0, 1, "Thứ tự phải lớn hơn hoặc bằng 0.", 0, ""); $myform->add("sta_date", "sta_date", 1, 1, 0, 0, "", 0, ""); $myform->add("sta_description", "sta_description", 0, 0, "", 0, "", 0, ""); $myform->add("sta_description1", "sta_description1", 0, 0, "", 0, "", 0, ""); #+ #+ đổi tên trường thành biến và giá trị
<?php require 'config_security.php'; $record_id = getValue("record_id", "arr", "POST", ''); //Warning Error! $errorMsg = ""; //Get Action. //Call Class generate_form(); $db_query = new db_query('SELECT MAX(mod_order) as max_order FROM ' . $fs_table); $max_order = mysqli_fetch_assoc($db_query->result); $max_order = $max_order['max_order']; $myform = new generate_form(); $myform->add("mod_name", "mod_name", 0, 0, "", 1, "Bạn chưa nhập tên module", 0, ""); $myform->add("mod_path", "mod_path", 0, 0, "", 0, "", 0, ""); $myform->add("mod_listname", "mod_listname", 0, 0, "", 0, "", 0, ""); $myform->add("mod_listfile", "mod_listfile", 0, 0, "", 0, "", 0, ""); $myform->add("mod_order", "mod_order", 1, 0, 0, 0, "", 0, ""); //Add table $myform->addTable($fs_table); $iQuick = getValue("action", "str", "POST", ""); if ($iQuick == "execute") { $errorMsg = ''; $errorMsg .= $myform->checkdata(); if ($errorMsg == "") { //echo $myform->generate_insert_SQL(); $db_ex = new db_execute($myform->generate_insert_SQL()); unset($db_ex); //Hien thi loi } redirect($_SERVER['REQUEST_URI']); }
<?php require_once 'inc_security.php'; checkPermission('add'); #Phần code xử lý $myform = new generate_form(); $myform->addTable($bg_table); /** * Something here ... * insert, update... */ $myform->add('dic_key', 'key', 0, 0, '', 1, 'Bạn chưa nhập nội dung cần dịch'); $myform->add('dic_translate_en', 'translate_en', 0, 0, '', 1, 'Bạn chưa nhập bản dịch tiếng Anh'); $form_redirect = getValue('form_redirect', 'str', 'POST', ''); $action = getValue('action', 'str', 'POST', ''); if ($action == 'execute') { $bg_errorMsg = $myform->checkdata(); /** * something code here */ //upload file ở đây //upload voice giọng nam $file_name = 'audio_' . time() . '.wav'; $file_path = '../../../sounds/' . $file_name; $upload_voice_en = upload_file('voice_en', $file_path); if ($upload_voice_en['success']) { //upload thành công $file_name = $upload_voice_en['file_name']; $myform->add('dic_voice_en', 'file_name', 0, 1, ''); } else { //không thành công, tìm file trong thư mục ghi âm