01.08.2015, 10:48
The problem might be here but idk how to fix this shit i cant understand this its mysql.
PHP код:
if(dialogid == 1) //Dialog Register
{
if(response)
{
if(!strlen(inputtext) || strlen(inputtext) > 20)
{
SendClientError(playerid, "You need to login, otherwise you can not spawn");
Kick(playerid);
}
else if(strlen(inputtext) > 0 && strlen(inputtext) < 20)
{
new escpass[20];
mysql_real_escape_string(inputtext, escpass);
MySQL_Register(playerid, escpass);
}
}
if(!response)
{
SendClientInfo(playerid, "You need to login before you can play here");
Kick(playerid);
}
}
if(dialogid == 2) //Dialog login
{
if(!response) //If they click the cancel button
{
SendClientError(playerid, "You must login before you spawn!"); //Sends the client a error message
Kick(playerid);
}
if(response) //If the player clicked login
{
new query[200], pname[24], escapepass[100];
GetPlayerName(playerid, pname, 24); //Gets the players name
mysql_real_escape_string(inputtext, escapepass); //We escape the inputtext to avoid SQL injections.
format(query, sizeof(query), "SELECT `user` = '%s' FROM `PlayerInfo` WHERE `user` = '%s' AND password = '%s'", pname, pname, escapepass);
mysql_query(query);
mysql_store_result();
new numrows = mysql_num_rows();
if(numrows == 1) MySQL_Login(playerid);
if(!numrows) MySQL_LoginFailed(playerid);
mysql_free_result();
}
}