[Solved]Password Incorrect even when correct -
AaronFarley - 18.06.2013
Problem Solved. Thanks from Ace.
Re: Password Incorrect even when correct -
Alternative112 - 18.06.2013
you're using the variable 'pass' in your SQL query. So your query looks like this when it runs:
SELECT `Name` FROM Users WHERE Name = 'noob' AND Password = 'password'"
you wanna use FinalPassword for the second argument in your query format so that it looks for the hash in the database, not the string of what the player inserted.
Re: Password Incorrect even when correct -
SwisherSweet - 18.06.2013
you made it so it olny looks for the username and not for the password Alternative showed you how.
Re: Password Incorrect even when correct -
AaronFarley - 18.06.2013
ok, changed it but now the server crashes whenever i click login, no errors appear in the server log either.
Re: Password Incorrect even when correct -
SwisherSweet - 18.06.2013
Code:
new query[200],pname[24],password[30],carquery[1000], savestring[80],savestring1[MAX_PLAYER_NAME], Cars[74];
GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
forgot about that tell me if it works.
Re: Password Incorrect even when correct -
AaronFarley - 18.06.2013
Nope still crashing upon login
Re: Password Incorrect even when correct -
Pooh7 - 18.06.2013
Debug your code to see at which point it crashes or set up the
crashdetect.
Re: Password Incorrect even when correct -
SwisherSweet - 19.06.2013
i liked pooh's idea debug your whole script and see where it crashes then post that script and we will fix it(try to fix it)
Re: Password Incorrect even when correct -
Alternative112 - 19.06.2013
Printing out the
mysql_num_rows(); result in your log will help, too. You should include that with the crash details.
Re: Password Incorrect even when correct -
AaronFarley - 19.06.2013
Code:
----------
Loaded log file: "server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3x, ©2005-2013 SA-MP Team
[21:28:55]
[21:28:55] Server Plugins
[21:28:55] --------------
[21:28:55] Loading plugin: oldmysql
[21:28:55]
> MySQL plugin R5 successfully loaded.
[21:28:55] Loaded.
[21:28:55] Loading plugin: sscanf
[21:28:55]
[21:28:55] ===============================
[21:28:55] sscanf plugin loaded.
[21:28:55] © 2009 Alex "Y_Less" Cole
[21:28:55] 0.3d-R2 500 Players "dnee"
[21:28:55] ===============================
[21:28:55] Loaded.
[21:28:55] Loading plugin: streamer
[21:28:55]
*** Streamer Plugin v2.6.1 by Incognito loaded ***
[21:28:55] Loaded.
[21:28:55] Loading plugin: Whirlpool
[21:28:55]
[21:28:55] ==================
[21:28:55]
[21:28:55] Whirlpool loaded
[21:28:55]
[21:28:55] ==================
[21:28:55]
[21:28:55] Loaded.
[21:28:55] Loading plugin: GeoIP_Plugin
[21:28:57] GeoIP_Plugin got loaded.
[21:28:57] Loaded.
[21:28:57] Loading plugin: nativechecker
[21:28:57] Loaded.
[21:28:57] Loaded 6 plugins.
[21:28:57]
[21:28:57] Ban list
[21:28:57] --------
[21:28:57] Loaded: samp.ban
[21:28:57]
[21:28:57]
[21:28:57] Filterscripts
[21:28:57] ---------------
[21:28:57] Loading filterscript 'weather.amx'...
[21:28:57]
--------------------------------------
[21:28:57] Transport Universe Weather System Loaded
[21:28:57] --------------------------------------
[21:28:57] Loaded 1 filterscripts.
[21:28:57] Attempting MySQL connection. Attempt: 1
[21:28:59] Connected to the MySQL server!
[21:28:59]
----------------------------------
[21:28:59] Blank Gamemode by your name here
[21:28:59] ----------------------------------
[21:28:59] Number of vehicle models: 0
[21:29:41] Incoming connection: 127.0.0.1:2908
[21:29:41] [join] Aaronf has joined the server (0:127.0.0.1)
----------
Loaded log file: "server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3x, ©2005-2013 SA-MP Team
[21:30:09]
[21:30:09] Server Plugins
[21:30:09] --------------
[21:30:09] Loading plugin: oldmysql
[21:30:09]
> MySQL plugin R5 successfully loaded.
[21:30:09] Loaded.
[21:30:09] Loading plugin: sscanf
[21:30:09]
[21:30:09] ===============================
[21:30:09] sscanf plugin loaded.
[21:30:09] © 2009 Alex "Y_Less" Cole
[21:30:09] 0.3d-R2 500 Players "dnee"
[21:30:09] ===============================
[21:30:09] Loaded.
[21:30:09] Loading plugin: streamer
[21:30:09]
*** Streamer Plugin v2.6.1 by Incognito loaded ***
[21:30:09] Loaded.
[21:30:09] Loading plugin: Whirlpool
[21:30:09]
[21:30:09] ==================
[21:30:09]
[21:30:09] Whirlpool loaded
[21:30:09]
[21:30:09] ==================
[21:30:09]
[21:30:09] Loaded.
[21:30:09] Loading plugin: GeoIP_Plugin
[21:30:10] GeoIP_Plugin got loaded.
[21:30:10] Loaded.
[21:30:10] Loading plugin: nativechecker
[21:30:10] Loaded.
[21:30:10] Loaded 6 plugins.
[21:30:10]
[21:30:10] Ban list
[21:30:10] --------
[21:30:10] Loaded: samp.ban
[21:30:10]
[21:30:10]
[21:30:10] Filterscripts
[21:30:10] ---------------
[21:30:10] Loading filterscript 'weather.amx'...
[21:30:10]
--------------------------------------
[21:30:10] Transport Universe Weather System Loaded
[21:30:10] --------------------------------------
[21:30:10] Loaded 1 filterscripts.
[21:30:10] Attempting MySQL connection. Attempt: 1
[21:30:12] Connected to the MySQL server!
[21:30:12]
----------------------------------
[21:30:12] Blank Gamemode by your name here
[21:30:12] ----------------------------------
[21:30:12] Number of vehicle models: 0
[21:30:39] Incoming connection: 127.0.0.1:2912
[21:30:40] [join] Aaronf has joined the server (0:127.0.0.1)
----------
Loaded log file: "server_log.txt".
----------
printf(" Checked Usernames And Password")
It seemed to have crashed during or after executing this line:
format(query, sizeof(query), "SELECT `Name` FROM Users WHERE Name = '%s' AND Password = '%s'", pname, FinalPassword);
because following is just the MySql Querying and saving the results.
Also now its asking me to "Login" even with a new account
Re: Password Incorrect even when correct -
Alternative112 - 19.06.2013
You didn't include the debug plugin, so no crash info printed. So that log doesn't really help much.
I'm gonna say either
mysql_query(query); or
mysql_store_result(); is crashing it. Try printing out the query into the logs (before you use it and cause the crash), then executing the query with MySQL or SQLite or whatever database software you're using. Run the query and see if it returns anything or gives an error.
Re: Password Incorrect even when correct -
Delta 4 - 19.06.2013
Instead of ''SELECT Name FROM...'', try ''SELECT * FROM...'', switch by '*' on the select
Re: Password Incorrect even when correct -
AaronFarley - 23.06.2013
Good news: Fixed the crash problem it was due to the connection being killed by my firewall.
Bad New: Login after registration is still bugged :/
Re: Password Incorrect even when correct -
Alternative112 - 23.06.2013
What did it print out for the SQL query in the logs when you tried to log in? and what was the result when you ran that query in MySQL / your SQL program?
Re: Password Incorrect even when correct -
AceFlyer - 25.06.2013
the length you specified for the password in the table is only 30 whereas the
whirlpool hash length is 132 so only part of the password is getting matched with the hash string
pawn Code:
new FinalPassword[132], pass[132];
Password VARCHAR(30)
replace
pawn Code:
mysql_query("CREATE TABLE IF NOT EXISTS Users(UserID INT(20), Name VARCHAR(24), Score INT(20), Password VARCHAR(30), Money INT(20), Admin INT(5))");
with this
pawn Code:
mysql_query("CREATE TABLE IF NOT EXISTS Users(UserID INT(20), Name VARCHAR(24), Score INT(20), Password VARCHAR(132), Money INT(20), Admin INT(5))");
tested and works fine
Re: Password Incorrect even when correct -
AaronFarley - 25.06.2013
Thanks a bunch man. Highly appreciated.
Check your /Messages in game.