예제 #1
0
파일: edit.php 프로젝트: virutmath/suckhoe
<?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;
예제 #2
0
$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;
        }
    }
}
예제 #3
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();
		}
	}
예제 #4
0
$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;
        }
    } else {
        $db_update = new db_execute('UPDATE links SET lin_status = ' . LINK_STATUS_FAIL . ' WHERE lin_id = ' . $link_id);
        echo 'Không lấy tin <a href="' . $link_url . '">' . $link_url . '</a>';
예제 #5
0
$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ị
$myform->evaluate();
예제 #6
0
파일: add.php 프로젝트: virutmath/suckhoe
            rename('../../../temp/' . $picture_temp, $path_upload);
        }
        $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) {
            //insert detail
            $myform_detail = new generate_form();
            $myform_detail->addTable('news_disease_detail');
            $myform_detail->add('ndi_id', 'last_id', 1, 1, 0);
            $myform_detail->add('ndi_detail', 'ndi_detail', 0, 0, '', 1);
            $myform_detail->removeHTML(0);
            $db_insert = new db_execute($myform_detail->generate_insert_SQL());
            redirect($form_redirect);
        }
    }
}
#Phần hiển thị
$rainTpl = new RainTPL();
$rainTpl->assign('load_header', $load_header);
$rainTpl->assign('module_name', $module_name);
$rainTpl->assign('error_msg', print_error_msg($bg_errorMsg));
$html_page = '';
$form = new form();
$html_page .= $form->form_open();
$html_page .= $form->textnote('Các trường có dấu (<span class="form-asterick">*</span>) là bắt buộc nhập');
/**
예제 #7
0
<? //generate by dinhtoan@finalstyle.com
require_once("inc_security.php");
checkAddEdit("edit");	//check quyền them sua xoa

$returnurl = base64_decode(getValue("returnurl","str","GET",base64_encode("listing.php")));
//Khai bao Bien
$errorMsg = "";
$iQuick = getValue("iQuick","str","POST","");
if ($iQuick == 'update'){
	$record_id = getValue("record_id", "arr", "POST", "");
	if($record_id != ""){
		for($i=0; $i<count($record_id); $i++){
			checkRowUser($fs_table,$field_id,$record_id[$i],$returnurl);
			$errorMsg="";		
			$myform = new generate_form();	//Call Class generate_form();
			$myform->removeHTML(0);	//Loại bỏ chuc nang thay the Tag Html
			//Insert to database
			# $myform->add("mnu_type","mnu_type" . $record_id[$i],0,0,"",1,"",0,"");
			$myform->add("mnu_name","mnu_name" . $record_id[$i],0,0,"",1,"",0,"");
			$myform->add("mnu_order","mnu_order" . $record_id[$i],0,0,"",0,"",0,"");
			$myform->add("mnu_check","mnu_check" . $record_id[$i],0,0,"",0,"",0,"");
			$myform->add("mnu_link","mnu_link" . $record_id[$i],0,0,"",0,"",0,"");
			# $myform->add("mnu_target","mnu_target" . $record_id[$i],0,0,"",0,"",0,"");
			

			//Add table
			$myform->addTable($fs_table);
			
			if($array_config["image"]==1){
				$upload_pic = new upload("picture" . $record_id[$i], $fs_filepath, $extension_list, $limit_size);
				if ($upload_pic->file_name != ""){