ZKLibrary icon indicating copy to clipboard operation
ZKLibrary copied to clipboard

Sending Data to library

Open test8git opened this issue 7 years ago • 64 comments

Hi, could you please explain me, that how (and in which format) i will send data from device to test.php or zkLibrary? How to use the library? Please describe with an example. Thanks

test8git avatar Oct 07 '17 05:10 test8git

You can use setUser function On example bellow, there are 3 users.

  1. Kamshory Role = Super Manager Serial ID = 1 User ID = 100001 Password = password1 (optional)

  2. Mas Roy Role = User Serial ID = 2 User ID = 100002 Password = password2 (optional)

  3. Linda Role = User Serial ID = 3 User ID = 100003 Password = password3 (optional)

If the data is from database, you can repeat $zk->setUser for each data but only in once connection.

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

$zk->setUser(1, '100001', 'Kamshory', 'password1', 14); // as super manager
$zk->setUser(2, '100002', 'Mas Roy', 'password2', 0); // as user
$zk->setUser(3, '100003', 'Linda', 'password1', 0); // as user

$zk->enableDevice();
?>

kamshory avatar Oct 08 '17 08:10 kamshory

Before you write data to the device, you must find out the last Serial ID. The new user must have Serial ID larger than the biggest existing Serial ID.

kamshory avatar Oct 08 '17 08:10 kamshory

Thank you very much sir. But i want to read data from the device (for new user) & store into database. So that next time when the same user login, i can match with stored data.

Thakns!

test8git avatar Oct 09 '17 04:10 test8git

If you want to get user data from the device and save it to the database, you can use getUser function. The password is plain text. You can use hash function before you save it into the database for security reason.

kamshory avatar Oct 11 '17 08:10 kamshory

And how i will send finger print data ? $received_data = ? $zk = new ZKLibrary('192.168.137.105', 4370,null,0,???);

test8git avatar Oct 11 '17 08:10 test8git

To get data from fingerprint and save it to the database, see code bellow:

<?php
include "zklibrary.php";
$zk = new ZKLibrary('192.168.1.102', 4370);
$zk->connect();
$zk->disableDevice();
$users = $zk->getUser();
foreach($users as $key=>$user)
{
   $sql = "insert into `person` (`uid`, `id`, `name`, `level`, `password`) values
   ('$key', '$user[0]', '".addslashes($user[1])."',  '$user[2]', '".addslashes($user[3])."');";
   mysql_query($sql); 
}
$zk->enableDevice();
?>

kamshory avatar Oct 12 '17 06:10 kamshory

Thank you very much, I will check and let you know. 👍

test8git avatar Oct 12 '17 12:10 test8git

Good luck. If you have a problem, tell me please.

kamshory avatar Oct 13 '17 02:10 kamshory

Brother can you help me how can get data attendance insert to database thanks so much brother

harisklana avatar Dec 01 '17 11:12 harisklana

First, you must define your own database to save the data. Then, you create a PHP script to load data from device and insert it into database.

<?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);
}

?>

kamshory avatar Dec 01 '17 14:12 kamshory

mas terimakasih banyak mas. atas pencerahannya

On Fri, Dec 1, 2017 at 9:53 PM, Kamshory, MT [email protected] wrote:

First, you must define your own database to save the data. Then, you create a PHP script to load data from device and insert it into database.

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);}?>

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kamshory/ZKLibrary/issues/6#issuecomment-348514795, or mute the thread https://github.com/notifications/unsubscribe-auth/Agk8Ilu36K0u59F7hH7sgcho5wET9T18ks5s8BMEgaJpZM4PxPJw .

harisklana avatar Dec 05 '17 16:12 harisklana

you are welcome

kamshory avatar Dec 08 '17 23:12 kamshory

I have successfully read fingerprint template from the device but failed when write it. I have read all reference on hundreds website but still not working. I use Solution X100-C

for reading getUserTemplate($uid, $finger) for writing setUserTemplate($data)

I invite all of you to contribute to this library.

kamshory avatar Dec 10 '17 01:12 kamshory

Hello, Thank you for your nice library it's very helpful 👍 I have a question please about attendance How can i know in or out record ?

Thanks in advance

elattari avatar Jan 29 '18 22:01 elattari

You can do it on your application. The first check on the day is check in and the last check on the day is check out. So you need at least two records on one day.

kamshory avatar Jun 01 '18 07:06 kamshory

Hello, Thanks for your work!, but I have a problem, when I try tu put a comm_key, where can I put this info, because when I develop some tool in c sharp, works obviously, but I don't know where or how I can add this info in your library, please help me.

waldopanozo avatar Jul 13 '18 22:07 waldopanozo

Hello, It is working nice. But i am facing some problem for loading time. When i wan to connect at least 20 device by ip address , it is working slow. How can i connect multiple device and get attendance data with very much fast. I am saving data into a file.

Thanks for your help

sumon01914 avatar Jul 21 '18 11:07 sumon01914

How machine automatically push data to the server

himahshu20 avatar Jul 21 '18 19:07 himahshu20

Hello Sir, am using secureye biometric machine (S-B7CB). I have different kinds of bio-metric machine and am finding common data downloader for all machines. When am trying to connect biometric machine through your zk php code, its not work. after checking its can not connect to machine. It gives failed to connect. Please help me

santosh-1993 avatar Jul 24 '18 07:07 santosh-1993

Hello, How to active or inactive register user without delete enroll user from the device? Also how to enroll user with RFID card number. thanks in advance

shofiuddin avatar Jul 31 '18 04:07 shofiuddin

You can not do it to the device but you can do it from your application.

kamshory avatar Jul 31 '18 06:07 kamshory

hello, is there any gateway or api to handle machine data like punches through PHP language or any other languages for all biometric machines.

Thanks & Regards, Santosh Rankhambe Project Manager at SALGEM INFOIGY Tech Pvt Ltd. +91 888 837 1993

On Tue, Jul 31, 2018 at 12:21 PM, Kamshory, MT [email protected] wrote:

You can not do it to the device but you can do it from your application.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kamshory/ZKLibrary/issues/6#issuecomment-409114702, or mute the thread https://github.com/notifications/unsubscribe-auth/AYiOPmNqByhxTWfRyOyFFgYFvqZg2Y63ks5uL_6OgaJpZM4PxPJw .

santosh-1993 avatar Aug 07 '18 12:08 santosh-1993

how the step if i want to send data to fingerprint device from other fingerprint device ?

fajarpratamaputra avatar Aug 24 '18 01:08 fajarpratamaputra

insert into presensi berdasarkan range tanggal presensi gmna pak?https://github.com/kamshory/ZKLibrary/issues/6#issuecomment-348514795

kallolo avatar Sep 04 '18 08:09 kallolo

@kamshory hello sir... is it possible to get data from specific user?

einsthony avatar Sep 06 '18 08:09 einsthony

No. You must read all data because library not support filter data

kamshory avatar Sep 08 '18 04:09 kamshory

how about getting the last data entered sir??

einsthony avatar Sep 09 '18 00:09 einsthony

first, you must read your data from your device then save it into you database. second, you can read data from your database as you want.

kamshory avatar Sep 12 '18 03:09 kamshory

First, you must define your own database to save the data. Then, you create a PHP script to load data from device and insert it into database.

<?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);
}

?>

I can not read the data from this code, although reading the user list is still possible. Please help me!

biencuong avatar Sep 12 '18 15:09 biencuong

Not fetching data at remote server working at local server can you guide how we can access device data at remote server.

malikatiq786 avatar Sep 22 '18 19:09 malikatiq786