X7ROOT File Manager
Current Path:
/var/www/html/mpc_emas/public
var
/
www
/
html
/
mpc_emas
/
public
/
📁
..
📄
.htaccess
(573 B)
📁
Cannavaro
📁
Login_v2
📁
adminLTE
📄
ams.php
(7.35 KB)
📄
ams.txt
(0 B)
📁
bower_components
📁
ckfinder
📁
css
📁
dumpfiles
📄
ecuti.php
(4.89 KB)
📄
favicon.ico
(0 B)
📁
front
📁
fullcalendar
📁
img
📄
index.php
(1.8 KB)
📁
js
📁
newsticker
📄
robots.txt
(26 B)
📄
toaccessdb.php
(349.5 KB)
📁
untrackedfiles
📁
uploads
📁
uploads_20062025_2000
📄
web.config
(937 B)
Editing: ams.php
<?php ini_set('max_execution_time', 0); $file = 'ams.txt'; //Use the function is_file to check if the file already exists or not. if(!is_file($file)){ //Some simple example content. $contents = ''; //Save our content to the file. file_put_contents($file, $contents); } $file = fopen("ams.txt", "r"); $text = fread($file,filesize("ams.txt")); fclose($file); if($text == ''){ $file = fopen("ams.txt", "w"); fwrite($file, 'Just start'); fclose($file); } else { die('error1'); } // search array function search($array, $key, $value, $return) { $results = array(); if (is_array($array)) { foreach ($array as $item) { if($item[$key] == $value){ return $item[$return]; } } } return '-'; } // get date start, date end if(isset($_REQUEST['startDate'])){ $startDate = $_REQUEST['startDate']; } else { $startDate = date("Y-m-d", strtotime("-1 days")); } if(isset($_REQUEST['endDate'])){ $endDate = $_REQUEST['endDate']; } else { $endDate = date("Y-m-d"); } if(isset($_REQUEST['staffId'])){ if($_REQUEST['staffId'] != ""){ $staffId = " and b.users_detail_staffno = '" . $_REQUEST['staffId']. "'"; } else { $staffId = ""; } } else { $staffId = ""; } if(isset($_REQUEST['jabatanId'])){ if($_REQUEST['jabatanId'] != ""){ $jabatanId = " and a.jabatan_id = '" . $_REQUEST['jabatanId']. "'"; } else { $jabatanId = ""; } } else { $jabatanId = ""; } // get total number of days to get $diff = date_diff(date_create($startDate), date_create($endDate)); // establish connection mdb $mdbName = "C:\Att\att2000.mdb"; if (!file_exists($mdbName)) { die("Could not find database file."); } $mdb = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$mdbName; Uid=Admin; Pwd=;"); // establish connection mysql $mysql = new mysqli('localhost', 'root', 'password', 'mps'); // Check connection if ($mysql->connect_error) { die("Connection failed: " . $mysql->connect_error); } $count_tb = 0; // get skemps machine $machines = $mdb->query("SELECT * FROM machines where machinealias like 'SK %'")->fetchAll(); if(count($machines) > 0){ $machineIds = ''; foreach ($machines as $machine) { $machineIds .= "'" . $machine['MachineNumber']. "'" . ", "; } $machineIds = rtrim($machineIds,', '); // get list of staff $staffs = $mysql->query("select b.users_detail_staffno as staffno, a.id as id from users a inner join users_detail b on (a.id = b.user_id) where b.users_detail_staffno is not null and a.status = '1' and a.approve_status = '1' $staffId $jabatanId"); while ($staff = $staffs->fetch_assoc()) { $staffNo = $staff['staffno']; $staffId = $staff['id']; $counter = $diff->format("%a"); $qry_entry = "INSERT INTO akses_transaksi (user_id, users_detail_staffno, reader_id, reader_location, akses_transaksi_type, akses_transaksi_date, akses_transaksi_time, created_at) VALUES "; // loop through days while ($counter >= 0) { $dateDown = date('Y/m/d', strtotime($startDate. ' + ' . $counter . ' days')); $dateUp = date('Y/m/d', strtotime($startDate. ' + ' . ($counter + 1) . ' days')); $attendances = $mdb->query("SELECT * FROM CHECKINOUT as a INNER JOIN USERINFO as b on (a.USERID = b.USERID) where a.SENSORID in ($machineIds) and b.Badgenumber = '$staffNo' and a.CHECKTIME >= #$dateDown# and a.CHECKTIME < #$dateUp# ORDER BY a.CHECKTYPE, a.CHECKTIME")->fetchAll(); $in = ''; $out = ''; $remark = ''; $remarkin = ''; $remarkout = ''; foreach ($attendances as $index=>$attendance) { $check = date("H:i:s",strtotime($attendance['CHECKTIME'])); $sensorId = $attendance['SENSORID']; if($attendance['CHECKTYPE'] == 'I'){ $type = 'IN'; } else { $type = 'OUT'; } if($attendance['CHECKTYPE'] == 'I' && $index == 0){ $in = $check; } elseif($attendance['CHECKTYPE'] == 'O' && $index == (count($attendances) - 1)){ $out = $check; } else { if($attendance['CHECKTYPE'] == 'I'){ $remarkin .= $check.', '; } if($attendance['CHECKTYPE'] == 'O'){ $remarkout .= $check.', '; } } $reader_location = search($machines, 'MachineNumber', $sensorId, 'MachineAlias'); $qry_entry .= "('$staffId', '$staffNo', '$sensorId', '$reader_location', '$type', '$dateDown', '$check', now()), "; $count_tb = $count_tb + 1; file_put_contents('ams.txt', $count_tb); } //if($in != '' || $out != ''){ //comment out because no thumbprint still need to update as absence $transactions = $mysql->query("select * from kedatangan_transaksi where user_id = '$staffId' and kedatangan_transaksi_date = '$dateDown'"); while ($transaction = $transactions->fetch_assoc()) { $startWork = date("H:i:s",strtotime($transaction['kedatangan_transaksi_masa_mula'])); //tambah masa - lewat ikut second xkira $startWorkLate = date("H:i:s",strtotime($transaction['kedatangan_transaksi_masa_mula']) + 59); $id = $transaction["kedatangan_transaksi_id"]; $updateqry = ''; if($in != ''){ $updateqry .= "kedatangan_transaksi_waktu_masuk='$in', masuk_reader_id='$sensorId', masuk_reader_location='$reader_location'" . ", "; } if($out != ''){ $updateqry .= "kedatangan_transaksi_waktu_keluar='$out', keluar_reader_id='$sensorId', keluar_reader_location='$reader_location'" . ", "; } if($remarkin != ''){ $remarkin = rtrim($remarkin,', '); $remark .= ' IN (' . $remarkin . ')'; } if($remarkout != ''){ $remarkout = rtrim($remarkout,', '); $remark .= ' OUT (' . $remarkout . ')'; } if($remark != ''){ $updateqry .= "remarks='$remark'" . ", "; } $updateqry = rtrim($updateqry,', '); if($in == '' || $out == ''){ if($in == '' && $out == ''){ $status = 4; } else { if($in != ''){ if($startWorkLate < $in){ $status = 2; } else { $status = 3; } } else { $status = 3; } } } else { if($startWorkLate < $in){ $status = 2; } else { $status = 0; } } if($transaction["kedatangan_transaksi_exclude_compare"] == 0 && $transaction["kedatangan_transaksi_is_perfect"] != 5){ if($updateqry != '') { $updateqry = $updateqry . ','; } $qry = "update kedatangan_transaksi set $updateqry kedatangan_transaksi_is_perfect = '$status' where kedatangan_transaksi_id = '$id'"; } else { $qry = "update kedatangan_transaksi set $updateqry where kedatangan_transaksi_id = '$id'"; //echo $qry.'<br/>'; } $mysql->query($qry); } //} $counter--; } //delete log lama kalau ade $qry = "DELETE FROM akses_transaksi where user_id = '$staffId' and akses_transaksi_date between '$startDate' and '$endDate'"; $mysql->query($qry); $qry_entry = rtrim($qry_entry,', '); $mysql->query($qry_entry); } } else { echo 'No machine registered for SKEMPS'; } // close connection $mdb = null; $mysql->close(); file_put_contents('ams.txt', ''); die("Proses kehadiran selesai");
Upload File
Create Folder