File manager - Edit - /home/autoph/public_html/api/aha/asa_getMyAttendance.php
Back
<?php include '../../../cfg/connhr.php'; $mykey = $_GET['keyID']; if($mykey =="6e59e008b5348b452b615a3033729daae383TITO"){ $userID = $_GET['userID']; $myEndDateX = date('Y-m-d'); $sql = "SELECT `time_keeping_id` AS timeKeepingID FROM `employees` WHERE `employee_id`='$userID' AND `date_resign` IS NULL LIMIT 1"; $result = $connhr->query($sql); if ($result->num_rows > 0) { while($rowID = $result->fetch_assoc()) { $timeKeepingID = $rowID['timeKeepingID']; } } // SQL query //$sqlA = "SELECT * FROM `timelogs` WHERE `time_keeping_id` = '$timeKeepingID' GROUP BY datetimelog ORDER BY `datetimelog` DESC LIMIT 30"; /**SELECT *, SUBSTRING_INDEX(datetimelog, ' ', 1) AS log_date, -- Extracts the date part before the space SUBSTRING_INDEX(datetimelog, ' ', -1) AS log_time -- Extracts the time part after the space FROM timelogs WHERE time_keeping_id = '60470' GROUP BY log_date ORDER BY log_date DESC LIMIT 30; */ $sqlA = "SELECT *, SUBSTRING_INDEX(datetimelog, ' ', 1) AS log_date, -- Extracts the date part before the space SUBSTRING_INDEX(datetimelog, ' ', -1) AS log_time -- Extracts the time part after the space FROM timelogs WHERE time_keeping_id = '$timeKeepingID' GROUP BY log_date ORDER BY log_date DESC LIMIT 30"; $result = $connhr->query($sqlA); if ($result->num_rows > 0) { $count = 0; $rows = array(); while($row = $result->fetch_assoc()) { if($cssBG == "cssWhite"){ $cssBG ="cssBlue"; }else{ $cssBG ="cssWhite"; } $dateLog =""; $dateLog =explode(" ",$row['datetimelog']); $newTimeAMPM = new DateTime($dateLog[1]); $formattedTime = $newTimeAMPM->format("g:i A"); $tagIN=$row['in_out']; if($tagIN == $currentINOUT){ $myCSS='redCSS'; }else{ $myCSS='grayCSS'; } $rows[] = [ 'id' => $row['id'], 'TimeKeepingID' => $row['time_keeping_id'], 'in_out' => $row['in_out'], 'dateLog' => $dateLog[0], 'timeLog' => $formattedTime, 'timeCSS' =>$myCSS, 'bgCSS' =>$cssBG ]; $currentINOUT = $row['in_out']; } } header('Content-Type: application/json'); echo json_encode([$rows,"userID"=>"$userID","timeKeepingID"=>"$timeKeepingID"]); } $connhr->close(); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings