ok
Direktori : /home2/selectio/www/obnovit-tracking/api/ |
Current File : /home2/selectio/www/obnovit-tracking/api/own-attendance-checkin-checkout.php |
<?php include"../config/config.php"; if($_POST['type']=="update_checkin"){ $emp_id = $_POST['emp_id']; date_default_timezone_set("Asia/Kolkata"); //India time (GMT+5:30) $checkin_time= date('H:i:s'); $date = date('Y-m-d'); $statement = $pdo->prepare("INSERT INTO `tbl_attendance`(`empid`,`check_in`,`att_date`, `added_by`) VALUES (?,?,?,?)"); $result=$statement->execute(array($_POST['emp_id'],$checkin_time,$date,$_POST['created_by'])); if($result){ $response['error']=false; $response['message']="Own Attendance Details Successfuly"; }else{ $response['error']=true; $response['message']='failed'; } echo json_encode($response); } if($_POST['type']=="update_checkout"){ $emp_id = $_POST['emp_id']; date_default_timezone_set("Asia/Kolkata"); //India time (GMT+5:30) $checkout_time= date('H:i:s'); $date = date('Y-m-d'); $statement = $pdo->prepare("UPDATE tbl_attendance SET check_out=?,updated_by=? WHERE empid=? and att_date=?"); $result=$statement->execute(array($checkout_time,$_POST['updated_by'],$emp_id,$date)); if($result){ $response['error']=false; $response['message']="Own Attendance Check out Successfuly"; }else{ $response['error']=true; $response['message']='failed'; } echo json_encode($response); } ?>