vodvud / php_zklib

GNU General Public License v2.0
23 stars 19 forks source link

Set Card Number #12

Closed mahdiapple closed 4 years ago

mahdiapple commented 4 years ago

Hi. I change Scripts for set Card Number for user: ZKlib.php public function setUser($uid, $userid, $name, $password, $role = Util::LEVEL_USER,$card) { return (new ZK\User())->set($this, $uid, $userid, $name , $password, $role,$card); }

User.php ` public function set(ZKLib $self, $uid, $userid, $name, $password, $role = Util::LEVEL_USER ,$card) {

    $self->_section = __METHOD__;

    if (
        (int)$uid === 0 ||
        (int)$uid > Util::USHRT_MAX ||
        strlen($userid) > 9 ||
        strlen($name) > 24 ||
        strlen($password) > 8
    ) {
        return false;
    }

    $command = Util::CMD_SET_USER;
    //echo $command;
    $byte1 = chr((int)($uid % 256));
    $byte2 = chr((int)($uid >> 8));
    $command_string = implode('', [
        $byte1,
        $byte2,
        chr($role),     
        str_pad($password, 8, chr(0)),
        str_pad($name, 24, chr(0)),
        str_pad($card, 13, chr(0)), 
        //str_pad(chr(1), 9, chr(0)),
        str_pad($userid, 8, chr(0)),
        str_repeat(chr(0), 16)
    ]);

print_r($command_string); return $self->_command($command, $command_string); }`

example.php: $zk->setUser(60, '60', 'name', '12345', ZK\Util::LEVEL_ADMIN,12345678);

But set another number after set card number:123456 card number after set :0875770417

vodvud commented 4 years ago

Hello! This issue still not solved. See the #2

Mahfuz2811 commented 4 years ago

I have solved this issue. Check this url.

https://stackoverflow.com/questions/55023178/zkteco-rfid-id-reader-through-php-zklibrary?noredirect=1#comment102231828_55023178

mornsina commented 4 years ago

I have solved this issue. Check this url.

https://stackoverflow.com/questions/55023178/zkteco-rfid-id-reader-through-php-zklibrary?noredirect=1#comment102231828_55023178

I am so thank you for helping. it is working now. It's working with my devices model B3-C and G4 face detection

But one more thing it can not connect with ZKAccess controller my device model C3-400.

vodvud commented 4 years ago

Fixed in commit e277b4bbe3bc93d11d2aacb773bf188770d78fd8

vodvud commented 4 years ago

@mornsina Maybe it depends model? For model U260-C it works properly.

mahdiapple commented 4 years ago

I have solved this issue. Check this url.

https://stackoverflow.com/questions/55023178/zkteco-rfid-id-reader-through-php-zklibrary?noredirect=1#comment102231828_55023178

Hi! So thank you. It is working for me in ZK TFT and Iface models but in Black&White models (tf1700) not working.

vodvud commented 4 years ago

Thanks all for check on different devices, this issue closed. If will have any question please open new one.