| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/onesupportdemo.onesolution.hk/contract/ |
Upload File : |
<?php
session_start();
require_once(__DIR__ . '/../checkuser.php');
//-----------------------------------------------------------------------------
// Check permission
//-----------------------------------------------------------------------------
//if (!Util::isAdmin()) {
// redirectAndExit('index.php?message=No permission!');
//}
//-----------------------------------------------------------------------------
// Save if POST method
//-----------------------------------------------------------------------------
if (isPost()) {
//check the type of contract, no need to do with type 2 (package)
$now = date("Y-m-d H:i:s");
$remarks = $_POST["task_remarks"];
$titles = $_POST["task_title"];
$task_category_ids = $_POST["task_category_id"];
$arraynum = $_POST["arraynum"];
foreach ($arraynum as $key2 => $rownum) {
$start_date_task = $_POST["start_date_" . $rownum];
$end_date_task = $_POST["end_date_" . $rownum];
foreach ($titles as $key => $title) { //each task add the start date and end date
$_remarks = $remarks[$key];
$_task_category_id = $task_category_ids[$key];
$sql = "insert into sup_period_task (contract_id, customer_id, task_title, task_remarks,task_category_id, createdate, createby, lastupdate, lastupby, start_date, end_date) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
//echo $sql;
$parameters = array($_POST['contract_id'], $_POST["customer_id"], $title, $_remarks, $_task_category_id, $now, $_SESSION['webadmin']['id'], $now, $_SESSION['webadmin']['id'], $start_date_task, $end_date_task);
if (!($sth = $dbh->prepare($sql))) {
throw new Exception("sql prepare statement failure: $sql");
}
$sth->setFetchMode(PDO::FETCH_ASSOC);
if (!$sth->execute($parameters)) {
throw new Exception("sql execute statement failure: $sql");
}
}
}
$_SESSION["remark_contract_id"] = $_POST['contract_id'];
if(!empty($arraynum)){
redirectAndExit("index.php?message=New Contract Task Created.");
}else{
redirectAndExit("index.php?message=No Action.");
}
}