Password Incorrect even when correct
#1

Problem Solved. Thanks from Ace.
Reply
#2

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.
Reply
#3

you made it so it olny looks for the username and not for the password Alternative showed you how.
Reply
#4

ok, changed it but now the server crashes whenever i click login, no errors appear in the server log either.
Reply
#5

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.
Reply
#6

Nope still crashing upon login
Reply
#7

Debug your code to see at which point it crashes or set up the crashdetect.
Reply
#8

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)
Reply
#9

Printing out the mysql_num_rows(); result in your log will help, too. You should include that with the crash details.
Reply
#10

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
Reply
#11

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.
Reply
#12

Instead of ''SELECT Name FROM...'', try ''SELECT * FROM...'', switch by '*' on the select
Reply
#13

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 :/
Reply
#14

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?
Reply
#15

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
Reply
#16

Thanks a bunch man. Highly appreciated.
Check your /Messages in game.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)