Path : /var/www/html/smart_kpp2_bk17 มีค 69/time/
File Upload :
Current File : /var/www/html/smart_kpp2_bk17 มีค 69/time/index.php

<?php 
session_start();
require_once ("Connections/smartconn.php");  

$lat =(get_magic_quotes_gpc()) ? $_GET ['lat']  : addslashes($_GET['lat']);
$long =(get_magic_quotes_gpc()) ? $_GET ['long']  : addslashes($_GET['long']);
 
$date_se =(get_magic_quotes_gpc()) ? $_GET ['date']  : addslashes($_GET['date']);
if($date_se ==""){
	$date_today = date("Y-m-d");
	$date_se = $date_today;
}

$message="";
if(count($_POST)>0) {

$result = mysqli_query($smart,"SELECT * FROM person_main WHERE person_id='".$_POST["person_id"]."'");
$row  = mysqli_fetch_array($result);
if(is_array($row)) {
//$_SESSION["id"] = $row['id'];
$_SESSION["person_id"] = $row['person_id'];
$_SESSION["school_code"] = $row['school_code'];
$_SESSION["user"] = $row['prename']."".$row['name']." ".$row['surname'];


$_SESSION["date_se"] = $date_se;

} else {
$message = "ไม่พบข้อมูลของท่าน ตรวจสอบข้อมูลอีกครั้ง !";
}
}
if(isset($_SESSION["person_id"])) {
header("Location:work_check.php?lat=$lat&long=$long");
}
?>

<!DOCTYPE html>
<html>
  <head>
  <?php include ("meta.php");?>  
  <?php if($lat == '' and $long == ''){ //ถ้าไม่มี lat long ให้กลับไปหน้าหาพิกัด ?>
	<META HTTP-EQUIV="Refresh" CONTENT="0;URL=gps.php">
   <?php }?>
  
</head>
<body>
<div class="container-fluid">
<div class="row">

 <div class="col-lg-12">
    <div class="card ">
    	<div class="card-header bg-success"><h1 style="color: #ffffff;"><?php echo $system_name?></h1>

<h2 style="color: #ffffff;"><?php echo $address;?></h2>
    	</div>	
    	<div class="card-body">
<?php
require_once ("Connections/smartconn.php");  
$URL2 =(get_magic_quotes_gpc()) ? $_GET ['URL']  : addslashes($_GET['URL']);
$date =(get_magic_quotes_gpc()) ? $_GET ['date']  : addslashes($_GET['date']);
$URL2 = "$URL2"."?date=$date";
$thai_w=array("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์");
  $thai_n=array("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม");
  $w=$thai_w[date("w")];
  $d=date("d");
  $n=$thai_n[date("n") -1];
  $y=date("Y") +543;
  $t=date("เวลา H นาฬิกา i นาที s วินาที");
  $t2=date("เวลา H. i น.");
  $date_thai = "$d $n $y";
  
  //$date_today = date("Y-m-d"); //วันปัจจุบัน คศ. 2020-03-15
  $date_today = $date;
  $day=date('w', strtotime("$date_today")); //เช็ควัน 0-6 วันอาทิตย์ - วันเสาร์
?>
<center>
<br><?php
   //$date =date("Y-m-d H:i:s");
  //กำหนดวันเดือนปีไทย
  $thai_w=array("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์");
  $thai_n=array("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม");
  $w=$thai_w[date("w")];
  $d=date("d");
  $n=$thai_n[date("n") -1];
  $y=date("Y") +543;
  $t=date("เวลา H นาฬิกา i นาที s วินาที");
  $t2=date("เวลา H. i น.");
  $date_thai = "$d $n $y";
  
  $date_today = date("Y-m-d"); //วันปัจจุบัน คศ. 2020-03-15
  $day=date('w', strtotime("$date_today")); //เช็ควัน 0-6 วันอาทิตย์ - วันเสาร์
  //$day=1;
  if($day==0){
    $day_name="<font color=red>วันอาทิตย์</font>";
  }else if($day==1){
    $day_name="<font color=#FFCC33>วันจันทร์</font>";
  }else if($day==2){
    $day_name="<font color=FUCHSIA>วันอังคาร</font>";
  }else if($day==3){
    $day_name="<font color=GREEN>วันพุธ</font>";
  }else if($day==4){
    $day_name="<font color=#FF6600>วันพฤหัสบดี</font>";
  }else if($day==5){
    $day_name="<font color=#3399FF>วันศุกร์</font>";
  }else if($day==6){
    $day_name="<font color=#990099>วันเสาร์</font>";
  }

  echo "<h2> $day_name ที่ $date_thai";
  //แสดงวันหยุด

  if($day == 0 or $day == 6){
  $Holiday = '1';
  echo "<br><font color=red> (วันหยุดราชการ)</font></h2>";
  }
  ?>
<form name="checkForm">
<h1><input type="text" class="btn btn-danger btn-lg" name="txtTime" id="txtTime" width="200" maxlength="200" value="" /></h1>
<script>
function show(){
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="AM" 
if (hours>=24)
dn="PM"
txt="ขณะนี้เวลา :: "
n="น."
if (hours>24)
hours=hours-24
if (hours==0)
hours=24
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
document.checkForm.txtTime.value=txt+""+hours+":"+minutes+":"
+seconds+" "+n
setTimeout("show()",1000)
}
show()
</script>
</form>

<form name="frmUser" method="post" action="" align="center">
 <?php $URL = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";?>
 <h1><?php 
 $date_se =(get_magic_quotes_gpc()) ? $_GET ['date']  : addslashes($_GET['date']);
 if($date_se == ''){ 
 	$date_se = date("Y-m-d");
 	}

  echo $_SESSION["person_id"];
 ?></h1>

 <label>กรอกเลขประจำตัวประชาชน</label>
 <input type="tel" name="person_id" class="form-control" value="<?php echo $_POST["userId"]; ?>" placeholder="เลขประจำตัวประชาชน" onKeyUp="if(isNaN(this.value)){ alert('กรุณากรอกตัวเลข'); this.value='';}" maxlength="13">

<input type="hidden" name="password" class="form-control" value="password">
<input type="hidden" name="lat" class="form-control" value="<?php echo $lat?>">
<input type="hidden" name="long" class="form-control" value="<?php echo $long?>">
<input type="hidden" name="date_se" class="form-control" value="<?php echo $date_se?>"><br>
<div class="message"><font color='red'><?php if($message!="") { echo $message; } ?></font></div>
<?php $date=date("Y-m-d");?>
<?php if($lat > '' and $long > ''){?>
	<h3>พิกัดของคุณ คือ <a href="https://www.google.com/maps/search/<?php echo $lat?>,<?php echo $long?>/17z" target="_blank"><?php echo $lat?>, <?php echo $long?></a></h3><br>
<?php }?>
<label><input type="submit" name="submit" value=" ตรวจสอบข้อมูล " class="btn btn-primary"></label>
<?php //if($date_se ==""){?>
	<!--a href="https://drive.google.com/file/d/1q5HupE6t-jwGcpLj5YUtPwaZZ3ZVgxkd/view" class="btn btn-info" role="button" target="_blank"><i class="fa fa-android" aria-hidden="true"></i> ติดตั้งแอพ Android</a -->
<?php //}?>


</form>

<a href="qrcode.php?URL=<?php echo $URL?>&date=<?php echo $date?>"><i class="fa fa-qrcode"></i> สร้าง QR-CODE</a>
<a href="<?php echo $url_web;?>"><i class="fa fa-home"></i> <?php echo $office_name2?></a> 
<br>
<a href="<?php echo $url_smart;?>"><i class="fa fa-book"></i> Smart Area <?php echo $office_name2?></a>

</div>
</div>
</div>
<div class="col-lg-12">
	<br>
<?php include ("footer.php");?>

</div>
</div>
<?php mysqli_close($smart);?>
</body>
</html>