Closed aice09 closed 5 years ago
Hello! You can see Set and Get methods into zklib/src/User.php
Also you may do backup user data and restore on other device using flash drive or ZkTeco Software.
@vodvud How to do it without using flashdrive? Can we do it using PHP code? Tranferring user data from A to other machine, any example sir?
Hi! You may get data from main device and in loop push to the other devices. But it will be only user data without fingerprint.
Example
<?php
include('zklib/ZKLib.php');
$users = [];
//Main device
$zk = new ZKLib('192.168.1.100');
$ret = $zk->connect();
if ($ret) {
$zk->disableDevice();
//Get users
$users = $zk->getUser();
$zk->enableDevice();
}
$zk->disconnect();
if (count($users) > 0) {
//Sync devices list
$devices = [
'192.168.1.101',
'192.168.1.102',
'192.168.1.103',
'192.168.1.104',
'192.168.1.105'
];
foreach ($devices as $ip) {
$zk = new ZKLib($ip);
$ret = $zk->connect();
if ($ret) {
$zk->disableDevice();
//Remove old users
$zk->clearUsers();
foreach ($users as $user) {
//Add user
$zk->setUser(
$user['uid'],
$user['userid'],
$user['name'],
$user['password'],
$user['role']
);
}
$zk->enableDevice();
}
$zk->disconnect();
}
}
@vodvud Can the RFID and password sync along with the users?
Then the code not working properly:
$devices
and to other device no data available.Hi! Code is ok, but it is possible if you get user data from device. Maximum count of records can depends device version and network quality, I not sure. See https://github.com/vodvud/php_zklib/issues/1#issuecomment-367200402
About data:
//Add user
$zk->setUser(
$user['uid'],
$user['userid'],
$user['name'],
$user['password'],
$user['role']
);
Password should be but not a cardnumber and fingerprint. Try to debug each data you get from main device.
Also ZKTeco didn't wanna to share detailed documentation about communication with device. Then we have what we have...
Current library support the model like this:
Web Server (push only user data from DB, and get attendance)
-- Device 1
-- Device 2
-- Device 3
-- Device 4
-- Device N
This mean you have some web application and you can a push user data to all device then manually register fingerprint or card. Also you may get attendance data to collect in data base and show attendance statistic. Any additional actions can be incorrect.
@vodvud I all have device TX628 it's device default capacity are listed below:
User(used/max) = 0/30000 Admin User = 0 Password = 0 Fingerprint = 0/3200 Badge (used/max) = 0/30000 ATT Record (used/max) = 0/120000
I try to check https://github.com/vodvud/php_zklib/issues/3 and I figured out that I can connect to my machine but cannot login used the following below, I don't know which credentials I need to use: Telnet
IP = 192.168.5.167 Port =23
In addition after I sync the data from 192.168.5.166 (A1) to 192.168.5.167 (B1) and 192.168.5.163(C1) the number of users transfer are only 774 (192.168.5.167) and 0 (192.168.5.163), the source total users are 1321(192.168.5.166) .
Telnet is deprecated. But you can only connect for testing connection, not more.
Try to debug received data from main device, then send to other devices.
Transferred user data is not stable sometime I got 170 sometimes 180 data from device B1 and still 0 to C1.
@vodvud , I get it. Your code is working! But in order to execute your code properly I adjust the Resources Limit in my php.ini. I adjust the max_execution_time=30 to max_execution_time=120 . And the max_input_time=30 to max_input_time=240. So I get the same data from biometrics A.
Given: A-192.168.5.166 B-192.168.5.164 C-192.168.5.165 D-192.168.5.168 E-192.168.5.169
I would like to ask if the user data from biometrics A can be copied or duplicated to other biometrics machine (B,C,D,and E).
Right now we are using the same biometrics but different system (created in C#,VB and .NET) to get the data from the machine to put to database and sync user data from biometrics A to B,C,D and E. Reference: https://www.codeproject.com/Articles/1104538/Csharp-ZKTeco-Biometric-Device-Getting-Started
It can be possible to do it?
The following image below is the system we use today to get data to our ZKTeco biometrics machine.