Jump to content

[REZOLVAT] Problema bcrypt-samp


Deagle
 Share

Recommended Posts

@Banditul e ceva gresit aici? 

	Dialog:login(playerid, response, listitem, inputtext[])
{
    if(!response) 
        kickEx(playerid);
	    gQuery[0] = (EOS);
	    Query->(SQL, gQuery, 256, "SELECT * FROM `server_accounts` WHERE `userName` = '%e'LIMIT 1", returnName(playerid));
    exec_query->(SQL, gQuery);
	    cache_get_field_content(0, "userPassword", PlayerInfo[playerid][userPassword]);
    bcrypt_check(inputtext, PlayerInfo[playerid][userPassword], "OPC", "d", playerid);
	    return 1;
}
	

Edited by Deagle
Link to comment
Share on other sites

Dialog:login(playerid, response, listitem, inputtext[])
{
    if(!response)
        kickEx(playerid);
 
    gQuery[0] = (EOS);
 
    Query->(SQL, gQuery, 256, "SELECT `userPassword` FROM `server_accounts` WHERE `userName` = '%e'LIMIT 1", returnName(playerid));
    new Cache: cache = exec_query->(SQL, gQuery);
 
    cache_get_field_content(0, "userPassword", PlayerInfo[playerid][userPassword], SQL, BCRYPT_HASH_LENGTH);
	cache_delete(cache);

    bcrypt_check(inputtext, PlayerInfo[playerid][userPassword], "OPC", "d", playerid);
 
    return 1;
}

Problema e faptul ca functia cache_get_field_content nu poate prelua string size dintr-un enum asa ca trebuie sa specifici tu. Apropo daca executi mysql_query si nu stergi cache vei face multe memory leaks si vei umple memoria RAM cu lucruri pe care nu le poti sterge. Si ca pont, nu trebuie sa faci SELECT * daca ai nevoie doar de o singura chestie, e compelt inutil si ineficient

https://wiki.sa-mp.com/wiki/MySQL/R33#cache_get_field_content

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...