Exemple #1
0
 /**
  *  创建新组件  参数传入文件信息
  */
 public function set_model($mid, $file_sing = null)
 {
     $this->load->helper('date');
     $this->load->helper('oracledb');
     $data = array('ID' => $mid, 'MTID' => $this->input->post('mtype'), 'Level' => $this->input->post('level'), 'Name' => $this->input->post('name'), 'Exename' => $file_sing[0]['file_name'], 'Exepath' => $file_sing[0]['file_path'], 'FileSize' => $file_sing[0]['file_size'], 'FileExt' => $file_sing[0]['file_ext'], 'Runsys' => $this->input->post('runsys'), 'Exeremark' => trim($this->input->post('exeinfo')), 'DeBugFlag' => $this->input->post('debugflag'), 'Info' => trim($this->input->post('modeldesc')), 'ICON' => $this->input->post('iconc'), 'ISVIEW' => 1);
     $this->db->insert('T_PPC_Module', $data);
     $date = updateTime($mid, 'T_PPC_Module', 'CreateTime');
     return $mid;
 }
 /**
  * 程序信息入库
  */
 public function set_programs($file_sing = null)
 {
     $this->load->helper('url');
     $this->load->helper('oracledb');
     $id = getCurSequeens("SEQ_PPC_PROGRAM");
     $data = array('ID' => $id, 'ISVIEW' => 1, 'Exename' => $file_sing[0]['file_name'], 'Exepath' => $file_sing[0]['file_path'], 'Runsys' => $this->input->post('runsys'), 'Exeremark' => $this->input->post('exeinfo'), 'Exetype' => $this->input->post('exetype'), 'Version' => $this->input->post('version'));
     $this->db->insert('T_PPC_Program', $data);
     updateTime($id, 'T_PPC_Program', 'CreateTime');
     return $id;
 }
 /**
  * 新建生产线
  */
 public function set_productline($showxml)
 {
     $this->load->helper('url');
     $this->load->helper('oracledb');
     $id = getCurSequeens("SEQ_PPC_PRODUCTLINE");
     $codes = $this->input->post('selectcodes');
     $staid = $this->input->post('staid');
     $devcode = $this->input->post('devcode');
     $isload = $this->input->post('isload');
     $linetype = $this->input->post('linetype');
     $caption = "pl_" . $id . "_" . $staid;
     $alias = $this->input->post('alias');
     $data = array('ID' => $id, 'Code' => $codes, 'SatCode' => $staid, 'Caption' => $caption, 'Alias' => $alias, 'DevCode' => $devcode, 'LINETYPE' => $linetype, 'ISLOAD' => $isload, 'Version' => 'a0', 'RawVer' => '-1', 'Status' => "run", 'Author' => "", 'ISVIEW' => 1);
     //以下是直接使用oci做clob的插入
     $sid = $this->config->item('dbusrsid');
     $password = $this->config->item('dbusrpassword');
     $dburl = $this->config->item('dbusrurl');
     $conn = oci_connect($sid, $password, $dburl, "AL32UTF8");
     $sql = "INSERT INTO\n                    \"T_PPC_ProductLine\"\n                      (\n                        ID,   \"Code\",\"SatCode\",\"Caption\",\"Alias\",\"RawVer\",\"Status\",\"DevCode\",LINETYPE,\"Author\",\"Version\",ISVIEW,ISLOAD,\n                        PLXML,\"ShowXml\"\n                      )\n                   VALUES\n                      ( " . $id . ",'" . $codes . "','" . $staid . "','" . $caption . "','" . $alias . "',-1,'run','" . $devcode . "','" . $linetype . "','','a0',1," . $isload . ",EMPTY_CLOB(), EMPTY_CLOB()\n                      )\n                   RETURNING\n                      PLXML,\"ShowXml\" INTO :pllob,:showlob";
     // echo $sql;
     $stmt = oci_parse($conn, $sql);
     $PlLOB = oci_new_descriptor($conn, OCI_D_LOB);
     $showLOB = oci_new_descriptor($conn, OCI_D_LOB);
     oci_bind_by_name($stmt, ":pllob", $PlLOB, -1, OCI_B_CLOB);
     oci_bind_by_name($stmt, ":showlob", $showLOB, -1, OCI_B_CLOB);
     oci_execute($stmt, OCI_DEFAULT) or die("Unable to execute query\n");
     if (!$PlLOB->save('') || !$showLOB->save('')) {
         oci_rollback($conn);
     } else {
         oci_commit($conn);
     }
     // Free resources
     oci_free_statement($stmt);
     $PlLOB->free();
     $showLOB->free();
     // $showxml = $this->input->post('formxml');
     updateShowCLOB($id, $showxml);
     $cdate = updateTime($id, 'T_PPC_ProductLine', 'CreateTime');
     $data['CreateTime'] = $cdate;
     return $data;
 }
Exemple #4
0
session_start();
require 'db.php';
date_default_timezone_set('Asia/Manila');
$conn = connect($config);
$data = [];
if (isset($_POST['login'])) {
    $id = (int) $_POST['id'];
    $loginTime = date("Y-m-d H:i:s");
    if (empty($id)) {
        $data['validation'] = 'Please fill out all fields.';
    } else {
        $query = query("SELECT * FROM faculties WHERE id = :id", ['id' => $id], $conn);
        $results = $query->fetchAll();
        foreach ($results as $result) {
            if (!empty($result)) {
                updateTime($result['id'], $loginTime, "log_in_time", $conn);
                $_SESSION['time'] = $loginTime;
                $_SESSION['id'] = $result['id'];
                $_SESSION['start'] = time();
                //$_SESSION['expire'] = $_SESSION['start'] + (1 * 60);//8hours = 480minutes; TODO: change 1 to 480 minutes to be exactly 8hours.
                header("location: profile.php?id=" . $result['id']);
            } else {
                $data['validation'] = 'No user found';
            }
        }
        $data['validation'] = 'Fill empty fields';
    }
}
?>