Tuesday, August 8, 2023

Time Attendance Machine Data Fetching Using PHP Code




In php.ini configure :- 
[semi colon must remove from these DLL File and Save INI File]
extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite3.dll

Now You Can Get User Data By This PHP Code :Required zklibrary File


<?php
include "zklibrary.php";
$zk = new ZKLibrary('192.168.1.7', 4370);
$zk->connect();
$zk->disableDevice();

$users = $zk->getUser();

$useridname= [[]];
  foreach($users as $key=>$user)
{
$useridname[$key][0] = $user[0];
$useridname[$key][1] = $user[1];

}
//echo count($useridname);


$attendance = $zk->getAttendance();

?>
<table width="100%" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse;">
<thead>
  <tr>
    <td width="25">No</td>
    <td>ID</td>
    <td>Name</td>
    <td>Role</td>
    <td>Date</td>
     <td>Time</td>
  </tr>
</thead>

<tbody>
<?php
$no = 0;
foreach($attendance as $key=>$user)
{
  $no++;
  if( date( "d-m-Y", strtotime( $user[3] )) ==date("d-m-Y") ){
?>

  <tr>
    <td align="right"><?php echo $no;?></td>
    <td><?php echo $user[1];?></td>
<?php
for($x=0;$x<count($useridname);$x++){
if($useridname[$x][0] == $user[1]){
?>
    <td><?php echo $useridname[$x][1];?></td>
<?php
}
}
?>
    <td><?php echo $user[2];?></td>
<td><?php echo date( "d-m-Y", strtotime( $user[3] ) ) ?></td>
     <td><?php echo date( "H:i:s", strtotime( $user[3] ) ) ?></td>
  </tr>

<?php
}
}
?>

</tbody>
</table>
<?php

$zk->enableDevice();
$zk->disconnect();

?>

No comments:

Post a Comment