[Help] With strcmp in a MySql login script!
#1

I'm trying to make this script works for a few days by myself. I dont have many knowledge over arrays so i cant figure out how to do it.
Please help meeeahh!

Quote:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == login)
{
new query[256];
format(query,sizeof(query),"SELECT `senha` FROM `usuario` WHERE `login` = '%s'",PlayerName(playerid));
mysql_query(query);
mysql_store_result();
PlayerStatistics[playerid][PASSWORD] = mysql_fetch_int();
if(strcmp( inputtext, PlayerStatistics[ playerid ][ PASSWORD ], true ) == 0 )
{
Logged[playerid]==1;
printf("[Login]: O usuario `%s` fez login com sucesso!",PlayerName(playerid));
SendClientMessage(playerid, COR_INFO, "You've been succesfully authed.");
new welcome[256];
format(welcome,sizeof(welcome),"Welcome back '%s' ",PlayerName(playerid));
SendClientMessage(playerid, COR_INFO, welcome);
}
else
{
new welcome[256];
format(welcome,sizeof(welcome),"Bad, bad password. Password entered: '%s' ",inputtext);
SendClientMessage(playerid, COR_BRANCO, welcome);
SendClientMessage( playerid, COR_BRANCO, "Bad, bad password. To avoid lammers you will be automatically disconnected." );
SetTimer("kicklogin", 10000, false);
}
return 0;
}
return 0;
}

I think the problem is in the red part. Im using the a_mysql.inc plugin, that one that almost everyone has.
In the password entered answer, it comes the right one. And in the MySql log:

Quote:

[13:16:25] ---------------------------

[13:16:25] MySQL Debugging activated (04/21/10)

[13:16:25] ---------------------------

[13:16:25]

[13:16:56] >> mysql_query( Connection handle: 1 )

[13:16:56] CMySQLHandler::Query(SELECT `login` FROM `usuario` WHERE `login` = 'Lucca_Xavier') - Successfully executed.

[13:16:56] >> mysql_store_result( Connection handle: 1 )

[13:16:56] CMySQLHandler::StoreResult() - Result was stored.

[13:16:56] >> mysql_num_rows( Connection handle: 1 )

[13:16:56] CMySQLHandler::NumRows() - Returned 1 rows(s)

[13:16:59] >> mysql_query( Connection handle: 1 )

[13:16:59] CMySQLHandler::Query(SELECT `senha` FROM `usuario` WHERE `login` = 'Lucca_Xavier') - Successfully executed.

[13:16:59] >> mysql_store_result( Connection handle: 1 )

[13:16:59] CMySQLHandler::StoreResult() - Result was stored.

[13:16:59] >> mysql_fetch_int( Connection handle: 1 )

[13:16:59] CMySQLHandler::FetchRow() - Return: MYPASSWORD!

Reply


Messages In This Thread
[Help] With strcmp in a MySql login script! - by kariok - 21.04.2010, 16:21
Re: [Help] With strcmp in a MySql login script! - by kariok - 23.04.2010, 01:00
Re: [Help] With strcmp in a MySql login script! - by Calgon - 23.04.2010, 01:20
Re: [Help] With strcmp in a MySql login script! - by kariok - 24.04.2010, 02:43
Re: [Help] With strcmp in a MySql login script! - by Calgon - 24.04.2010, 02:48

Forum Jump:


Users browsing this thread: 1 Guest(s)