[PHP Help] Password Check
#1

Hi guys,

I'm making an UCP and i have problems with login.My password are wrritten in next way(On SA-MP Server)

Код:
PlayerInfo[playerid][pPass] = udb_hash(inputtext);
Код:
stock udb_hash(buf[]) //HASH PASS
{
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}
Код:
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) //password check
I need help,how to make check for udb_hash on website(PHP).I'm beggginer for it
How to check is password good

Код:
$acc = $Db->getRow("SELECT * FROM accounts WHERE p_email = '".$email."' AND p_password = '".$pass."' ");
But it don't will work.I need check with udb_hash ...
Reply
#2

Use this in your Pawn script: https://sampwiki.blast.hk/wiki/SHA256_PassHash
Use this in your PHP script: http://php.net/manual/en/function.hash.php

Learn more about salts here http://php.net/manual/en/faq.passwords.php

The best solution would be to use plugins which support bcrypt or PBKDF2.
Reply
#3

I have server and registered accounts..(5000/6000) so i really don't want to change hash algorithm now if i don't need.Is may possible to make udb_hash function to work in php?(like in pawn) ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)