PHP Code:
if(cache_num_rows() >= 1)
{
cache_get_value_name(0, "IP", IP[playerid], 16);
new newIP[16];// query[300];
GetPlayerIp(playerid, newIP, 16);
IsPlayerRegistered[playerid] = 1;
if(strlen(IP[playerid]) != 0 && !strcmp(IP[playerid], newIP, true)) //Checks that the MySQL IP has a value and that they are the same.
{
new query[150];
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `Username` = '%e' LIMIT 1", pName(playerid));
mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
}
else
{
new string[280];
cache_get_value_name(0, "Password", pData[playerid][Password], 129);
//we will load player's password into pData[playerid][Password] to be used in logging in
cache_get_value_name_int(0, "ID", pData[playerid][ID]); //now let's load player's ID into pData[playerid][ID] so we can use it later
format(string,sizeof(string),"Welcome back to ZoneX {FFFA00}%s\n{FFFFFF}\nYour UserID: %d | Your account is registered on our database\nPlease type your password to login",GetName(playerid),pData[playerid][ID]);
ShowPlayerDialog(playerid, dLOGIN, DIALOG_STYLE_INPUT, "Login", string, "Login", "Quit"); //And since we found a result from the database, which means, there is an account; we will show a login dialog
}
}
the autologin is not working why?