Exemple #1
0
    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);
        }
    }
    echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
    echo "Đang cập nhật dữ liệu !";
    if ($errorMsgAll == "") {
        redirect($returnurl);
    }
}
Exemple #2
0
	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();
		}
	}
Exemple #3
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;
    if ($filename) {
        $myform->add('use_avatar', 'filename', 0, 1, '');
        foreach ($arr_resize as $type => $arr) {
            resize_image($bg_filepath, $filename, $arr["width"], $arr["height"], $arr["quality"], $type);
        }
        delete_file($bg_table, $id_field, $record_id, "use_avatar", $bg_filepath);
    }
    $bg_errorMsg .= $upload->show_warning_error();
    if ($bg_errorMsg == '') {
        $db_insert = new db_execute($myform->generate_update_SQL($id_field, $record_id));
        redirect('listing.html');
    }
}
//lấy dữ liệu record cần sửa đổi
$db_data = new db_query("SELECT * FROM " . $bg_table . " WHERE " . $id_field . " = " . $record_id);
if ($row = mysqli_fetch_assoc($db_data->result)) {
    foreach ($row as $key => $value) {
        ${$key} = $value;
    }
} else {
    exit;
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="vi" lang="vi" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml">
Exemple #4
0
//Insert to database
for($i=0;$i<count($arrayField);$i++){
	$myform->add($arrayField[$i][0],$arrayField[$i][0],$arrayField[$i][1],0,"",0,"",0,"");
}
//Add table
$myform->addTable($fs_table);
//Warning Error!
$errorMsg = "";
//Get Action.
$action	= getValue("action", "str", "POST", "");
if($action == "update"){
	//Check Error!
	$errorMsg .= $myform->checkdata();
	if($errorMsg == ""){
		$db_ex = new db_execute($myform->generate_update_SQL("con_lang_id",$_SESSION["lang_id"]));
		//echo $myform->generate_update_SQL("con_lang_id",$_SESSION["lang_id"]);
		//Redirect to:
		redirect($_SERVER['REQUEST_URI']);
		exit();
	}
}
//add form for javacheck
$myform->addFormname("setting");
$myform->checkjavascript();
//Select data
$db_data = new db_query("SELECT * FROM configuration WHERE con_lang_id = " . $_SESSION["lang_id"]);
if (mysql_num_rows($db_data->result) > 0)
{
	$row = mysql_fetch_array($db_data->result);
	$db_data->close();
Exemple #5
0
     $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');
         $array_return['msg'] = "Cập nhập thành công";
         $array_return['success'] = 1;
         die(json_encode($array_return));
     }
     break;
 case 'setup-system':
     break;
     // cập nhập thực đơn mặc định khi bắt đầu
 // cập nhập thực đơn mặc định khi bắt đầu
 case 'defaultMenus':
     global $configuration;
     //trước khi cập nhập sẽ xóa dữ liệu trong con_start_menu ở bảng configurations rồi sau đó sẽ thêm mới vào
Exemple #6
0
			}
			redirect($ff_redirect_succ);
			exit();
		}
}

//Edit user password
$errorMsgpass = '';
if ($Action =='update_password')
{
	$myform = new generate_form();
	$myform->add("adm_password","adm_password",4,0,"",1,translate_text("Please enter new password"),0,"");
	$myform->addTable($fs_table);
	$errorMsgpass .= $myform->checkdata();
	if($errorMsgpass == ""){
		$db_ex = new db_execute($myform->generate_update_SQL("adm_id",$iAdm));
		unset($db_ex);
		echo '<script>alert("' . translate_text("Your_new_password_has_been_updated") . '")</script>';
		redirect($ff_redirect_succ);
	}
}




//Select access module
$acess_module			= "";
$arrayAddEdit 			= array();
$db_access = new db_query("SELECT * 
									FROM admin_user, admin_user_right, modules
									WHERE adm_id = adu_admin_id AND mod_id = adu_admin_module_id AND adm_id =" . $iAdm);
Exemple #7
0
#+ đổi tên trường thành biến và giá trị
$myform->evaluate();

#+
#+ Neu nhu co submit form
if($action == "submitForm"){

	#+
	#+ Kiểm tra lỗi
    $errorMsg .= $myform->checkdata();
	$errorMsg .= $myform->strErrorField ;	//Check Error!
	if($errorMsg == ""){

		#+
		#+ Thuc hien query
		$query = $myform->generate_update_SQL($field_id,$record_id);
		$db_ex = new db_execute($query);
		# echo $query;exit();

		#+
		#+ Chuyen ve trang khac khi xu ly du lieu oki
		redirect($after_save_data . "?record_id=" . $record_id);
		exit();

	}
}

#+
#+ Khai bao ten form
$myform->addFormname("submitForm"); //add  tên form để javacheck
#+
Exemple #8
0
    $old_pass = getValue('old_pass', 'str', 'POST', '');
    if (md5($old_pass) != $_SESSION['password']) {
        $errorMsg .= 'Bạn nhập password cũ không chính xác';
    }
    $new_pass = getValue('new_pass', 'str', 'POST', '');
    $check_pass = getValue('check_pass', 'str', 'POST', '');
    if ($new_pass != $check_pass) {
        $errorMsg .= 'Bạn nhập password mới không khớp';
    } else {
        $new_pass = md5($new_pass);
    }
    $myform = new generate_form();
    $myform->addTable('admin_users');
    $myform->add('adm_password', 'new_pass', 0, 1, '', 1, 'Bạn nhập password chưa chính xác');
    if ($errorMsg == '') {
        $db_ex = new db_execute($myform->generate_update_SQL('adm_id', $admin_id));
        $success = 'Cập nhật thành công';
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Add New</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href="../css/bootstrap.css" rel="stylesheet"/>
<link href="../css/common.css" rel="stylesheet"/>
<link href="../css/template.css" rel="stylesheet"/>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
</head>
Exemple #9
0
 function EditRecord()
 {
     //check quyền
     checkCustomPermission('edit');
     //khai bao bien global
     global $time_end, $time_start;
     $promo_id = getValue('id', 'int', 'POST', 0);
     // id chien dich
     if (!$promo_id) {
         //lỗi không tồn tại id của khuyến mại
         $array_return['error'] = 0;
         $array_return['msg'] = 'Bản ghi không tồn tại';
         die(json_encode($array_return));
     }
     // ten chien dich khuyen mai
     $promo_name = getValue('name', 'str', 'POST', '', 2);
     if (!$promo_name) {
         //lỗi chưa nhập tên chiến dịch km
         $array_return['error'] = 0;
         $array_return['msg'] = 'Chưa nhập tên chiến dịch khuyến mại';
         die(json_encode($array_return));
     }
     $promo_agencies = getValue('agencies', 'int', 'POST', 0, 3);
     if (!$promo_agencies) {
         //lỗi chưa nhập tên chiến dịch km
         $array_return['error'] = 0;
         $array_return['msg'] = 'Chưa chọn cửa hàng áp dụng khuyến mại';
         die(json_encode($array_return));
     }
     // thoi gian bat dau
     $start_time = getValue('start_date', 'str', 'POST', '', 3);
     $time_start_h = getValue('time_start_h', 'int', 'POST', 0, 3);
     $time_start_i = getValue('time_start_i', 'int', 'POST', 0, 3);
     //thoi gian ket thuc
     $end_time = getValue('end_date', 'str', 'POST', '');
     $time_end_h = getValue('time_end_h', 'int', 'POST', 0, 3);
     $time_end_i = getValue('time_end_i', 'int', 'POST', 0, 3);
     // ghi chú
     $promo_note = getValue('note', 'str', 'POST', '');
     $list_menus = getValue('menus', 'arr', 'POST', array());
     // dieu kien giam gia
     $promo_condition = getValue('condition', 'str', 'POST', 0, 3);
     // gia tri giảm giá hóa đơn dựa vào kiểu giảm giá promo_type có 2 giá trị là % và tiền mặt
     $promo_value = getValue('promo_value', 'int', 'POST', 0, 3);
     $promo_type = getValue('promo_type', 'int', 'POST', 0, 3);
     $time_start = convertDateTime($start_time, $time_start_h . ':' . $time_start_i . ':0');
     if (!$time_start) {
         $array_return['error'] = 0;
         $array_return['msg'] = 'Chưa nhập thời gian bắt đầu chiến dịch';
         die(json_encode($array_return));
     }
     $time_end = convertDateTime($end_time, $time_end_h . ':' . $time_end_i . ':0');
     if (!$time_end) {
         $array_return['error'] = 0;
         $array_return['msg'] = 'Chưa nhập thời gian kết thúc chiến dịch';
         die(json_encode($array_return));
     }
     // ket quả tra ve
     // update chiến dịch khuyến mãi
     $myform = new generate_form();
     $myform->addTable('promotions');
     $myform->add('pms_name', 'name', 0, 0, $promo_name, 1, 'Bạn chưa nhập tên chiến dịch');
     $myform->add('pms_agency_id', 'agencies', 1, 0, $promo_agencies, 1, 'Bạn chưa chọn địa điểm áp dụng');
     $myform->add('pms_start_time', 'time_start', 0, 1, $time_start, 1, 'Thời gian bắt đầu chưa nhập');
     $myform->add('pms_end_time', 'time_end', 0, 1, $time_end, 1, 'Thời gian kết thúc chưa nhập');
     $myform->add('pms_value_sale', 'promo_value', 1, 0, $promo_value, 0);
     $myform->add('pms_type_sale', 'promo_type', 1, 0, $promo_type, 0);
     $myform->add('pms_condition', 'condition', 1, 0, $promo_condition, 0);
     $myform->add('pms_note', 'note', 0, 0, $promo_note, 0);
     if (!$myform->checkdata()) {
         $db_update = new db_execute($myform->generate_update_SQL('pms_id', $promo_id));
         //echo $myform->generate_update_SQL('pms_id', $promo_id);
         unset($db_update);
         //log action
         log_action(ACTION_LOG_ADD, 'Chỉnh sửa bản ghi ' . $promo_id . ' bảng promotions');
     }
     //xóa hết các thực đơn có trong chiến dịch khuyến mãi đang sửa và sau đó insert lại danh sách các thực đơn bổ sung
     $db_delete = new db_execute('DELETE FROM promotions_menu WHERE pms_id = ' . $promo_id . '');
     unset($db_delete);
     // insert lại những thực đơn cập nhập
     $db_insert = 'INSERT INTO promotions_menu(pms_id ,pms_menu_id, pms_menu_value, pms_menu_type)
                        VALUES';
     //sử dụng id của promotion để insert vào bảng promotions_menu
     foreach ($list_menus as $menu) {
         $db_insert .= '(
                        ' . $promo_id . ',
                        ' . $menu['men_id'] . ',
                        ' . $menu['men_value'] . ',
                        ' . $menu['men_type'] . '
                        ),';
     }
     $db_insert = rtrim($db_insert, ',');
     $db_insert_menu = new db_execute($db_insert);
     unset($db_insert_menu);
     // trả về kết quả thành công
     $array_return['success'] = 1;
     $array_return['msg'] = 'Cập nhật thành công';
     die(json_encode($array_return));
 }
Exemple #10
0
            $record_id = getValue('record_id', 'int', 'POST', 0);
            $myform = new generate_form();
            $myform->addTable($bg_table);
            $myform->add('fin_updated_time', 'fin_updated_time', 1, 1, $fin_updated, 0);
            $myform->add('fin_money', 'fin_money', 1, 0, 0, 0);
            $myform->add('fin_pay_type', 'fin_pay_type', 1, 0, PAY_TYPE_CASH);
            $myform->add('fin_cat_id', 'fin_cat_id', 1, 0, 0, 1, 'Bạn chưa chọn loại lý do chi');
            $myform->add('fin_reason_other', 'fin_reason_other', 0, 0, '');
            $myform->add('fin_billcode', 'fin_billcode', 0, 0, '');
            $myform->add('fin_username', 'fin_username', 0, 0, '', 1, 'Bạn chưa nhập tên người nộp tiền');
            $myform->add('fin_address', 'fin_address', 0, 0, '', 1, 'Bạn chưa nhập địa chỉ người nộp tiền');
            $myform->add('fin_note', 'fin_note', 0, 0, '');
            $myform->add('fin_admin_id', 'fin_admin_id', 1, 1, 0, 1, 'Bạn chưa đăng nhập');
            $bg_errorMsg .= $myform->checkdata();
            if (!$bg_errorMsg) {
                $db = new db_execute($myform->generate_update_SQL('fin_id', $record_id));
                unset($db);
                //log action
                log_action(ACTION_LOG_ADD, 'Chỉnh sửa phiếu chi ' . $record_id . ' bảng ' . $bg_table);
                redirect('index.php');
            }
            break;
    }
}
//Phần hiển thị
//Khởi tạo
$left_control = '';
$right_control = '';
$footer_control = '';
$left_column = '';
$right_column = '';
Exemple #11
0
     }
     break;
 case 'edit_user':
     $record_id = getValue('record_id', 'int', 'POST', 0);
     $myform = new generate_form();
     $myform->addTable('admin_users');
     $myform->add('adm_name', 'adm_name', 0, 0, '', 1, 'Chưa nhập tên hiển thị');
     $myform->add('adm_note', 'adm_note', 0, 0, '', 0, '');
     $myform->add('adm_group_id', 'adm_group_id', 1, 0, 0, 1, 'Bạn chưa chọn nhóm quản lý');
     $adm_password = getValue('adm_password', 'str', 'POST', '', 3);
     if ($adm_password) {
         $adm_password = md5($adm_password);
         $myform->add('adm_password', 'adm_password', 0, 1, '', 1, 'Chưa nhập mật khẩu');
     }
     if (!$myform->checkdata()) {
         $db_insert = new db_execute($myform->generate_update_SQL('adm_id', $record_id));
         //log action
         log_action(ACTION_LOG_EDIT, 'Sửa tài khoản ID ' . $record_id . ' bảng admin_users');
         redirect('index.php');
     }
     break;
 case 'permission_group':
     $record_id = getValue('record_id', 'int', 'POST', 0);
     $myform = new generate_form();
     //quyền sử dụng module
     $use_module = getValue('use_module', 'arr', 'POST', array());
     //xóa các permission cũ
     $db_del = new db_execute('DELETE FROM admin_group_role WHERE group_id = ' . $record_id);
     unset($db_del);
     foreach ($use_module as $module) {
         //list các luật đặc biệt
			
			if($array_config["image"]==1){
				$upload_pic = new upload("picture" . $record_id[$i], $fs_filepath, $extension_list, $limit_size);
				if ($upload_pic->file_name != ""){
					$picture = $upload_pic->file_name;
					//resize_image($fs_filepath,$upload_pic->file_name,100,100,75);
					$myform->add("mnu_picture","picture",0,1,"",0,"",0,"");
				}
				if ($upload_pic->file_name != ""){
					//Delete file
					//delete_file($fs_table,"cat_id",$record_id[$i],"cat_picture",$fs_filepath);
					//Permision file
				}
				//Check Error!
				$errorMsg .= $upload_pic->show_warning_error();
			}
			
			$errorMsg .= $myform->checkdata();
			$errorMsg .= $myform->strErrorField ;	//Check Error!
			if($errorMsg == ""){
				$db_ex = new db_execute($myform->generate_update_SQL("mnu_id",$record_id[$i]));
			}
			//echo $myform->generate_update_SQL("mnu_id",$record_id[$i]);exit();
		}
		//echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
		//echo tt("Sửa đổi thành công");
	}
	redirect($returnurl);

}
?>
Exemple #13
0
}
//Insert to database
foreach($arrayStatic as $key=>$value){
	$myform->add("$key","$key",1,0,1,0,"",0,"");
}
//Add table
$myform->addTable($fs_table);
//Warning Error!
$errorMsg = "";
//Get Action.
$action	= getValue("action", "str", "POST", "");
if($action == "update"){
	//Check Error!
	$errorMsg .= $myform->checkdata();
	if($errorMsg == ""){
		$db_ex = new db_execute($myform->generate_update_SQL("con_lang_id",$lang_id));
		//echo $myform->generate_update_SQL("con_id",1);
		//Redirect to:
		redirect($_SERVER['REQUEST_URI']);
		exit();
	}
}
//add form for javacheck
$myform->addFormname("setting");
$myform->checkjavascript();
//Select data
$db_data = new db_query("SELECT * FROM configuration WHERE con_lang_id = " . $lang_id);
if (mysql_num_rows($db_data->result) > 0)
{
	$row = mysql_fetch_array($db_data->result);
	foreach($arrayStatic as $key=>$value){
Exemple #14
0
<?php

require 'config_security.php';
$myform = new generate_form();
$record_id = getValue('record_id');
$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_update_SQL($field_id, $record_id));
        unset($db_ex);
        //Hien thi loi
    }
    redirect('websetting.php');
}