SA-MP Forums Archive
[PHP Help] Password Check - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: [PHP Help] Password Check (/showthread.php?tid=649511)



[PHP Help] Password Check - BalkanEliteRP - 10.02.2018

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 ...


Re: [PHP Help] Password Check - Mellnik - 10.02.2018

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.


Re: [PHP Help] Password Check - BalkanEliteRP - 10.02.2018

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