Jump to content

help..me


Andu Jame

Recommended Posts

<?

include("config/config.php");

include("fungsi_beza_masa.php");

$masa=date('H:i:s');

$i=0;

//$masa_awal=mktime(0,10,0,0,0,0);

//$masa_lewat=mktime(0,15,0,0,0,0);

$hari=date("w");

if($hari<=4 && $hari>=1){

$q="SELECT * FROM slot";

}

if($hari==5){

$q="SELECT * FROM slot_j";

}

 

$r=mysql_query($q);s

while($row=mysql_fetch_array($r)){

$id_slot=$row["id_slot"];

$masa_slot=$row["masa_slot"];

 

list($jam_slot, $minit_slot, $saat_slot) = split(":", $masa_slot);

//echo "slot : $jam_slot, $minit_slot, $saat_slot<br>";

list($jam, $minit, $saat) = split(":", $masa);

//echo "jam biasa : $jam, $minit, $saat<br>";

$t1=date("H:i:s", mktime($jam_slot-$jam, $minit_slot-$minit, $saat_slot-$saat, 0, 0, 0));

$t2=date("H:i:s", mktime($jam-$jam_slot, $minit-$minit_slot, $saat-$saat_slot, 0, 0, 0));

if($t1<'00:10:00'||$t2<'00:15:00'){

echo "Masa Boleh Punch t1 atau t2<tr>";

echo "masa slot semasa = $masa_slot dan masa = $masa,<br> tempoh ";

echo "t1 = $t1 dan t2 = $t2<br>";

//insert disini

if($hari<=4 && $hari>=1){

$q2="INSERT INTO maklumat_kedatangan (id_pelajar,tarikh,masa,id_slot) VALUES ('$id_pelajar','$tarikh','$masa','$id_slot')";

}

 

if($hari==5){

$q2="INSERT INTO maklumat_kedatangan (id_pelajar,tarikh,masa,id_slot_j) VALUES ('$id_pelajar','$tarikh','$masa','$id_slot_j')";

}

//echo "$q<br>";

  $r2=mysql_query($q2);

 

 

 

echo "Anda Telah Punch";

}

//echo "<meta http-equiv=\"refresh\" content=\"1;URL=punch.php\" a target = \"_self\"> ";

}

echo "<br>Jika mesej \"Anda Telah Punch\" Tidak Keluar, Anda Punch Diluar Waktu";

 

 

//echo "<meta http-equiv=\"refresh\" content=\"1;URL=punch.php\" a target = \"_self\"> ";

 

 

?>

 

Link to comment
https://forums.phpfreaks.com/topic/50326-helpme/#findComment-247090
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.