wrong password everytime (strcmp) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: wrong password everytime (strcmp) (
/showthread.php?tid=422108)
wrong password everytime (strcmp) -
Itzhak E. - 12.03.2013
I'm having trouble to fix this and I had this problem few times before. When I try to log-in into the character it's always saying wrong password even if it's the correct one.
Here's my code and thanks in advance!
Re: wrong password everytime (strcmp) -
MP2 - 12.03.2013
Debug. Use printf to see what the strings actually are.
Re: wrong password everytime (strcmp) -
Itzhak E. - 12.03.2013
Quote:
Originally Posted by MP2
Debug. Use printf to see what the strings actually are.
|
I used mysql_debug(1) and here's the results:
PHP код:
[14:18:41] ** MySQL Debugging enabled (03/12/13)
[14:18:41]
[14:18:59] >> mysql_query_callback( Connection handle: 1 )
[14:18:59] Passing query SELECT * FROM `playeraccounts` WHERE `username` = 'Player_Name' | ii
[14:19:00] ProcessQueryThread(OnQueryFinish) - Query was successful. (SELECT * FROM `playeraccounts` WHERE `username` = 'Player_Name')
[14:19:00] ProcessQueryThread(OnQueryFinish) - Data caching enabled.
[14:19:00] CMySQLHandler::StoreResult() - Result was stored.
[14:19:00] CMySQLHandler::FreeResult() - Result was successfully free'd.
[14:19:00] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[14:19:00] OnQueryFinish(ii) - Threaded function called.
[14:19:00] >> cache_get_data( Connection handle: 1 )
[14:19:00] ProcessTick() - The cache has been cleared.
The password of the account in the database is 123456, so what can you tell me about that?
Thanks!
Re: wrong password everytime (strcmp) -
MP2 - 12.03.2013
It has nothing to do with mySQL debugging. Read what I posted.
Re: wrong password everytime (strcmp) -
Itzhak E. - 12.03.2013
Okay I used printf to print the inputext and the Password from enum and it came back the same password, so the problem is here:
PHP код:
new szHashedPassword[129];
WP_Hash(szHashedPassword, 129, inputtext);
if(!response) return Kick(playerid);
if(response)
{
if(!strcmp(szHashedPassword, AccountData[playerid][szPassword]))
Re: wrong password everytime (strcmp) -
Jstylezzz - 12.03.2013
You know that strcmp returns 0 on succes right?
Re: wrong password everytime (strcmp) -
Itzhak E. - 12.03.2013
Quote:
Originally Posted by Jari_Johnson*
You know that strcmp returns 0 on succes right?
|
Yes, I know that.
Anyone please?
EDIT: Never mind, I fixed it! the problem actually was the hash and not the statement. L&A please.