kamshory / ZKLibrary

ZKLibrary is PHP library for reading and writing data to attendance device using UDP protocol. This library useful to comunicate between web server and attendance device directly without addition program. This library is implemented in the form of class. So that you can create an object and use it functions.
GNU General Public License v2.0
194 stars 176 forks source link

attendance #15

Open omar0555 opened 6 years ago

omar0555 commented 6 years ago

how get getAttendance()

getAttendance() Retrieve the attendance log.

Return Value

getAttendance return array 2 dimension. The value of array is array containing.

serial number of the user user id of the application state time of attendance in format YYYY-MM-DD HH:II:SS

update 2017

omar055 commented 6 years ago

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

$users = $zk->getUser();

?>

$user) { $no++; ?>
No UID ID Name Role Password
getAttendance(); sleep(1); while(list($idx, $attendancedata) = each($attendance)): if ( $attendancedata[2] == 14 ) $status = 'Check Out'; else $status = 'Check In'; ?>
Data Attendance
Index UID ID Status Tanggal Jam

get user just not getAttendance?????

kamshory commented 6 years ago
<?php
include "zklibrary.php";
$zk = new ZKLibrary('192.168.1.102', 4370);
$zk->connect();
$zk->disableDevice();

$data = $zk->getAttendance();
foreach($data as $key=>$value)
{
    $uid = $value[0];
    $id = $value[1];
    $state = $value[2];
    $time = $value[3];
    $sql = "insert into attendace(uid, id, state, time) values
    ('$uid', '$id', '$state', '$time')
    ";
    mysql_query($sql);
}

?>
omar0555 commented 6 years ago

Thank you very much Good luck

wombiro commented 5 years ago

@kamshory, is it possible to this code be triggered Everytime a check-in/checkout event is done?

I want to add other function as text sent to a number with state as soon as finger is identified. Thank sir for the library too

kamshory commented 5 years ago

No. Because device not push to the web server

zkenstein commented 5 years ago

@kamshory how to insert for the new record only to db?

kamshory commented 5 years ago

You can check it by the user ID and attendance time. If it not exists in your database, you can insert it to the database.