09.02.2014, 08:56
Why it can't compare password from table with "inputtext"?
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[500];
if(dialogid == 0)
{
if(response && strlen(inputtext) >= 4 && strlen(inputtext) <= 24)
{
format(string,sizeof(string),"INSERT INTO `players` (`name`, `pass`) VALUES('%s','%s')",PlayerName(playerid),inputtext);
mysql_query(string);
TogglePlayerSpectating(playerid, 0);
} else {
ShowPlayerDialog(playerid,0,DSI,"???????????/Register","??????? ??? ?????? (4-24 ???????):","??","");
}
return 1;
}
if(dialogid == 1)
{
if(response)
{
format(string,sizeof(string),"SELECT * FROM `players` WHERE `name` = '%s' LIMIT 1",PlayerName(playerid));
mysql_store_result();
new result[500];
if(mysql_fetch_row(result))
{
BaseGet("pass",string);
SendClientMessage(playerid,COLOR_RED,string);
if(strcmp(string,inputtext,false,24) == 0) TogglePlayerSpectating(playerid, 0);
} else {
ShowPlayerDialog(playerid,1,DSI,"????/Login","??????? ??? ??????:","??","");
}
mysql_free_result();
return 1;
}
}
return 1;
}
PHP код:
BaseGet(fieldi[],permi[])
{
new string[255];
mysql_get_field(fieldi,string);
format(permi,500,"%s",string);
}
PHP код:
[20:28:38] ---------------------------
[20:28:38] MySQL Debugging activated (02/08/14)
[20:28:38] ---------------------------
[20:28:38]
[20:28:38] >> mysql_ping( Connection handle: 1 )
[20:28:38] CMySQLHandler::Ping() - Connection is still alive.
[20:28:38] >> mysql_query( Connection handle: 1 )
[20:28:38] CMySQLHandler::Query(SELECT * FROM `players` WHERE `name` = 'kilohertz' LIMIT 1) - Successfully executed.
[20:28:38] >> mysql_store_result( Connection handle: 1 )
[20:28:38] CMySQLHandler::StoreResult() - Result was stored.
[20:28:38] >> mysql_fetch_row_format( Connection handle: 1 )
[20:28:38] CMySQLHandler::FetchRow() - Return: 1|kilohertz|syndi|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0
[20:28:38] >> mysql_free_result( Connection handle: 1 )
[20:28:38] CMySQLHandler::FreeResult() - Result was successfully free'd.
[20:28:42] >> mysql_store_result( Connection handle: 1 )
[20:28:42] CMySQLHandler::StoreResult() - No data to store.
[20:28:42] >> mysql_fetch_row_format( Connection handle: 1 )
[20:28:42] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)
[20:28:42] >> mysql_free_result( Connection handle: 1 )
[20:28:42] CMySQLHandler::FreeResult() - The result is already empty.
[20:28:46] >> mysql_store_result( Connection handle: 1 )
[20:28:46] CMySQLHandler::StoreResult() - No data to store.
[20:28:46] >> mysql_fetch_row_format( Connection handle: 1 )
[20:28:46] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)
[20:28:46] >> mysql_free_result( Connection handle: 1 )
[20:28:46] CMySQLHandler::FreeResult() - The result is already empty.
[20:29:22] >> mysql_ping( Connection handle: 1 )
[20:29:22] CMySQLHandler::Ping() - Connection is still alive.
[20:29:22] >> mysql_query( Connection handle: 1 )
[20:29:22] CMySQLHandler::Query(SELECT * FROM `players` WHERE `name` = 'kilohertz' LIMIT 1) - Successfully executed.
[20:29:22] >> mysql_store_result( Connection handle: 1 )
[20:29:22] CMySQLHandler::StoreResult() - Result was stored.
[20:29:22] >> mysql_fetch_row_format( Connection handle: 1 )
[20:29:22] CMySQLHandler::FetchRow() - Return: 1|kilohertz|syndi|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0
[20:29:22] >> mysql_free_result( Connection handle: 1 )
[20:29:22] CMySQLHandler::FreeResult() - Result was successfully free'd.
[20:29:28] >> mysql_store_result( Connection handle: 1 )
[20:29:28] CMySQLHandler::StoreResult() - No data to store.
[20:29:28] >> mysql_fetch_row_format( Connection handle: 1 )
[20:29:28] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)
[20:29:28] >> mysql_free_result( Connection handle: 1 )
[20:29:28] CMySQLHandler::FreeResult() - The result is already empty.
[20:29:32] >> mysql_store_result( Connection handle: 1 )
[20:29:32] CMySQLHandler::StoreResult() - No data to store.
[20:29:32] >> mysql_fetch_row_format( Connection handle: 1 )
[20:29:32] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)
[20:29:32] >> mysql_free_result( Connection handle: 1 )
[20:29:32] CMySQLHandler::FreeResult() - The result is already empty.