Giter Site home page Giter Site logo

dnaextrim / php_zklib Goto Github PK

View Code? Open in Web Editor NEW
156.0 47.0 135.0 64 KB

Attendance Machine Library for PHP with a connection to the network using the UDP protocol and port 4370

Home Page: http://dnaextrim.github.io/php_zklib/

License: GNU General Public License v2.0

PHP 100.00%

php_zklib's Introduction

PHP ZKLib

Attendance Machine Library for PHP with a connection to the network using the UDP protocol and port 4370

Donation!

NOW

This library is now beginning to be redeveloped and will come with complete documentation

php_zklib's People

Contributors

dnaextrim avatar jlallana avatar shubhamoy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php_zklib's Issues

State of attendance is not showing

The $state variable is not showing expected values.

$state = hexdec( substr( $u[1], 56, 2 ) );

I have this example value for $u[1]:

00003200323438363631370000000000000000000000000000000000003626481b0100000000ff00

So $state equals 0, but I know I should have some different values for checkins than for checkouts.
Any ideas?

Possible to add/update users?

Hi dnaextrim, thank you for providing your php_zklib! I am able to connect successfully to my ZKSoftware iClock 360. Is it possible to add or update users with your library? I will be using multiple attendance machines and I would like to have one in the main office. When new employees start, I want to enter them into one attendance machine (at the main office) and push their data to the appropriate machine where they will be working. Please let me know your thoughts.

Thank you!
indigo380

getAttendance()

hello, the method getAttendance() returns all attendance records. but as I get only the last month? or just the day ?

Note : the question would translate with google , sorry if not well expressed .

Cannot connect to device using new device

I am using this SDK to fetch attendance and put it to MySQL database. My old device with the manufacture year 2016 is working fine but new devices with 2017 made year can't be connected with this SDK. Please Help?

Show userid in attendance

After can show 256 character in userid, now i have a problem.

How can i see the time attendance with userid?

i search in zkattendance.php, there's no found the userid.

May somebody help me?

thx

Youtube Channel With Manual And Related SDK

Hi,

Great script!

Actually I tried all the code and sdk of the device. And I got Fatal error https://stackoverflow.com/questions/45951222/php-zklib-undefined-function-socket-create.

Fatal error: Uncaught Error: Call to undefined function socket_create() in C:\xampp\htdocs\php_zklib-master\zklib\zklib.php:16 Stack trace: #0 C:\xampp\htdocs\php_zklib-master\zktest.php(10): ZKLib->__construct('192.168.5.164', 4370) #1 {main} thrown in C:\xampp\htdocs\php_zklib-master\zklib\zklib.php on line 16

Can you create a youtube channel about this in order for us to easily get the follow and understand the way how to use this.
And please add the following manual and SDK if needed for this program and how to use each.

I hope for a favorable and positive response.

Thanks.

how to delete user

Everything is working correctly. But how to delete a user from the device?

Not UDP: 4370

I have a machine dw6 and I'm sure the protocol TCP:4370,
but why are all zklib library connected using UDP?

set Communication Key ?

How can we set a Communication key for the Library.

The Communication key is a password used by the machine so that only Auth. Requests are valid.

Thanks,

Not working with new device - guidance needed

I've bought a new ZK device (from a X628 to an IN01-A) and the attendance data stopped bringing correct User ids.

In other words, both the uids and the index in the attendance data are incremental, and not related to the users:

1228 =>
array (
0 => 12,
1 => 0,
2 => 1,
3 => '2016-05-02 08:31:07',
),
1229 =>
array (
0 => 13,
1 => 0,
2 => 1,
3 => '2016-05-02 08:31:12',
),
1230 =>
array (
0 => 14,
1 => 0,
2 => 1,
3 => '2016-05-02 08:39:40',
),
1231 =>
array (
0 => 15,
1 => 0,
2 => 1,
3 => '2016-05-02 08:50:16',
),
1232 =>
array (
0 => 16,
1 => 0,
2 => 1,
3 => '2016-05-02 08:54:55',
),
1233 =>
array (
0 => 17,
1 => 0,
2 => 1,
3 => '2016-05-02 08:59:10',
),

Can you guide me about how did you learn to decode the correct data? I've been looking at the functions, specially zkgetattendance function, and I would like to know how did you know where the uid and the other data were located. Did you read that in any official SDK?

Thanks in advance.

not showing role correctly

to fix this in "zkuser.php" change line 108:

$role = hexdec( substr($u[1], 4, 4) ).' ';

to:

$role = hexdec( substr($u[1], 6, 2) ).' ';

and "zktest.php" change lines 70-72:

if ($userdata[2] == LEVEL_ADMIN)
      $role = 'ADMIN';
elseif ($userdata[2] == LEVEL_USER)

to:

if ($userdata[4] == LEVEL_ADMIN)
       $role = 'ADMIN';
elseif ($userdata[4] == LEVEL_USER)

zk-attend.zip

zk->getAttendance() not returning any result

Hello.

We're trying to use your library to work with our F22 device but it's not returning any attendance logs.

It will load for a few minutes where it will display the device data and user data but when it finishes loading it just shows an empty attendance data table.

Do you have an idea why its not generating the attendance data?

Not Working on new device

Hi,
I used the library for the iClock990 device and it worked great, but now I'm using it on the uFace 800 at all.

Last record issue

Hey there ! This is a great tool.

Ive found that ALLWAYS leaves behind 1 record when calling getAttendance(). That is because last record in first commented line at last while loop len() is 38. Ive solved that by duplicating some code for last record and changing H80 to H60.

Im using x628c for time attendance.

Regards !

while ( strlen($attendancedata) > 40 ) {//_this line_

            $u = unpack( 'H80', substr( $attendancedata, 0, 40 ) );
            //24s1s4s11s
            //print_r($u);
            $uid = hex2bin( substr( $u[1], 0, 24 ) );
            $uid = explode(chr(0), $uid);
            $uid = intval( $uid[0] ); 
            $state = hexdec( substr( $u[1], 48, 2 ) );
            $timestamp = decode_time( hexdec( reverseHex( substr($u[1], 50, 8) ) ) ); 

            # Clean up some messy characters from the user name
            #uid = unicode(uid.strip('\x00|\x01\x10x'), errors='ignore')
            #uid = uid.split('\x00', 1)[0]
            #print "%s, %s, %s" % (uid, state, decode_time( int( reverseHex( timestamp.encode('hex') ), 16 ) ) )

            array_push( $attendance, array( $uid, $state, $timestamp ) );

            $attendancedata = substr( $attendancedata, 40 );
        //echo "at: '$attendancedata'".strlen($attendancedata)."<br/>";
        }


          $u = unpack( 'H60', $attendancedata);
            //24s1s4s11s
            //print_r($u);
            $uid = hex2bin( substr( $u[1], 0, 24 ) );
            $uid = explode(chr(0), $uid);
            $uid = intval( $uid[0] ); 
            $state = hexdec( substr( $u[1], 48, 2 ) );
            $timestamp = decode_time( hexdec( reverseHex( substr($u[1], 50, 8) ) ) ); 

            # Clean up some messy characters from the user name
            #uid = unicode(uid.strip('\x00|\x01\x10x'), errors='ignore')
            #uid = uid.split('\x00', 1)[0]
            #print "%s, %s, %s" % (uid, state, decode_time( int( reverseHex( timestamp.encode('hex') ), 16 ) ) )

            array_push( $attendance, array( $uid, $state, $timestamp ) );

setUser function not working.

function zksetuser($self, $uid, $userid, $name, $password, $role) {
$command = CMD_SET_USER;
$command_string = pack('sxs8s28ss7sx8s16s', chr( $uid ), chr($role), $password, $name, $chr(1), '', $userid, '' );
......
}


A parameter $chr(1) in the pack function,,I thought it's a little mistake,
and this function is not working when update/add the user's information,the variable $command_string always return false,but when I use python_zklib,everything goes all right,so,please give me a help,thx!

Showing a maximum of 256 users

Hi,
Thank you for this amazing library, great work ;)
I tested it and it works almost very fine, however there's a bug, i have 431 users on my zk attendance machine, but the script shows only 256 users.
Is there any advice to fix this ?
Thanks

Documentation

Where did you find any documentation about the protocol and commands? I would like to clone the repo and try to improve this.

Great work by the way!

hasil getattendace error di zem500

mohon bantuannya om,
saya coba di mesin presensi lama dengan platform zem500 layar hitam putih
hasilnya kacau, kebanyakan tahunnya berubah jadi 1970 dan banyak karakter-karakter aneh

tapi kalo di mesin presensi baru basisnya zem800 kalo gak salah, layar sudah berwarna
hasilnya oke

terima kasih sebelumnya

capture

Great work

Hi,
Its an amazing library and i appreciate your works:) , However i don't have an idea in handling binary data using php , i need a little help , checked that setting user/adding user is working but i want to set RFID card number using this library…..is there anyway to embed card number in "command string" ? I shall be thankful to any help

Getting attendance data

my device is connected i can get user data and attendance data but problem is i am not able to get attendance of last whole month its like if i am accessing getattendance() it returns data from last months 31st uptill now while i want it to get all the data.
untitled

zktest.php returns empty page

hi i've changed the ip address in zktest.php but when i view the page, i only have blank page.
is there any problem with it?
i tested manually telnet to the ip with port 4370 and it works but the page is empty.
please advise
thanks

Get Attendance format

@suryacaprice & @junaidranjha I have the array of all attendances.My array structure is like this.
[0] => 1
[1] => 1
[2] => 8 //it is state.What does this means for???
[3] => 2016-12-27 11:51:33

And one more thing that I have all the attendances of users,Please guide me that how I differentiate the check in and check out of user.

Dates are wrong

library get date like this 2049-01-01 .. ,
Could any body help ?

Not Working with CRON

When i run this script with cron to insert data in my database . its failed somethings . once its failed then the cron is working but script is not working any more . i don't understand the problem . please help .

performance when read in large data

My fingerprint have much data from 2015, when i use your's package, it takes me a long time when get attendance, can you optimal performance it

Warning: socket_recvfrom() for zk14 model

i am getting

Warning: socket_recvfrom(): unable to recvfrom [10060]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

while using zk 14 model.

Not supporting New Firmware 8.2

We are using F18 which has old firmware v6.8 and works fine on those devices.
We have recently bought new F18 which came with new firmware v8.2 , and its not working any more.
Could you please help me with it ?

attendancedata ID=0

Data Attendance
Index UID ID Status Tanggal Jam
0 37303 0 Check In 21-06-2017 13:28:24
1 37304 0 Check In 21-06-2017 13:56:44

Why is ID always 0 ?
Why are not real values ​​coming?

get data from public ip

I use https://github.com/cobisja/tad-php, it bases on your's package but it does't get data from device, it always return no data when i get user of attendance through public ip (i call public ip then IT support direct to ip of fingerprint machine) but when i use your's package, i always have get all data. Can you help me to fix it, thank :D

Set CardNo ?

could you update the setUser function to set the cardNo also. or how would you go about it... just some pointer would be great on how to do it.

saving data into mysql

how to save data into mysql
i've tried several steps but seems doesn't work does anyone know how to save data into mysql db

if (isset($_POST['create_post'])) {

      $query = "INSERT INTO attendance(idx)";
      $query .= "VALUES ($id)";
      $submittodbquery = mysqli_query($con,$query);
      if (!$submittodbquery) {
      die("Failed up upload " . mysqli_error($con));
    }else {
      echo "updated";
    }

    }

delete data

hi and thanks a lot for you great work ..
i need way to delete users and modify users and delete attendance
thanks again

connection problem

I have change the ip address in the test but in return nothing is show on test page then i open the test and echo the connection variable and i got false means connection is not made. can anyone help me please

Door Unlock

Hi,
First I want to thank you for this great script and the great effort you made to figure all this but beside all this I was looking for a small function or let's say the command that can be used to give the machine order to open the door in the access control system.

Actually I tried all the code and sdk of the device but I didn't figure it out although it is present in the web2.0 build in version which also I failed getting the source of it to modify and then get the command

So can you help me getting this command and if it is possible could you tell us how you calculate or figure made this features using the communication protocol manual

Thanks

data is not same with the log files

helli dnaextrim,

i really glad to found that someone has build the special library for attendance system handling. god bless you.

your library is cool. but i found something wrong with your library, and im not able enough to fix it.

this one is the real log data file

real data - log file

and this one is data that shown with your library
get data with library

there are alot of difference between real data.
A. time
the system always shown date 1hour+ than the real time.

B. attendance system data

can you help me to fix this things.
please.

thankyou.

PHP 7.2 Support

The current codes are not PHP 7.2 compatible. Please can you update the code.

How to get Face Image for user

Hi,
I can check the machine have face function on. I want to get the images stored for each registered users. What will be the function can you share the small hint as example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.