PHP код:
new
Query[600],
DBResult:Result,
storedip[16],
ip[16]
;
GetPlayerIp(playerid, ip, 16);
format(Query, sizeof(Query), "SELECT `password`, `IP` FROM `users` WHERE `username` = '%q'", User[playerid][accountName]);
Result = db_query(Database, Query);
if(db_num_rows(Result))
{
db_get_field_assoc(Result, "IP", storedip, 16);
db_get_field_assoc(Result, "password", User[playerid][accountPassword], 129);
if(strcmp(ip, storedip, false))
{
LoginPlayer(playerid);
LoginPremium(playerid);
return 1;
}
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", ""grey"Welcome to Express FreeRoam 2.1.\nYour account is registered in our database, Type your password below to log in.\n\nTIP: IF you are not the owner of this account,please type /q and choose another nickname.", "Login", "Cancel");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", ""grey"Welcome to our updated Express FreeRoam 2.1.\nThis account is not registered in our database,please enter a password to continue.\n\nСЪВЕТ: Make a strong password,so your account will be more secured.", "Register", "Quit");
}
db_free_result(Result);