Quote:
Originally Posted by Private200
So, I am having a problem with my accounts. I badly deleted a code I had that could load the accounts and I tried to create a custom code in order to open them.
Well, I do not know what the problem is, but it will always login even if there's no account registered.
This is the code I am using:
pawn Код:
new userquery[256]; format(userquery, sizeof(userquery), "SELECT * FROM Users WHERE Name = '%s'", PlayerName); mysql_query(MySQLConnection, userquery); mysql_store_result(MySQLConnection); new rows = mysql_num_rows(MySQLConnection); if(!rows) { ShowPlayerDialog(playerid, DIALOG_TYPE_LOGIN, DIALOG_STYLE_PASSWORD, "Server Login", "Server Login:\n\nThe account with the name you joined is already registered!\nType your password below to retrieve your stats!", "Login", ""); } if(rows == 1) { ShowPlayerDialog(playerid, DIALOG_TYPE_REGISTER, DIALOG_STYLE_INPUT, "Server Register", "Server Register:\n\nThe account with the name you joined is not yet registered!\nType your password below to save your stats!\n\nNote: Do not press ESC or you will be kicked.", "Register", "Kick"); } mysql_free_result(MySQLConnection);
Thanks...
|
wait what...
if no rows -> login
it should be
if (rows) // login dialog
else // register dialog
also don't fetch the whole table... you can do something like
Код:
select count(*) from `Users` where `Account` = '%s' limit 0,1;