11.11.2010, 22:28
pawn Код:
case 1:
{
if(!response)
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "You selected exit, therefore you were kicked.");
Kick(playerid);
}
else if(strlen(inputtext) == 0)
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "You must input the password to your account! If this is not your account, come back with a new name!");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login / Authentication Process", "Hello there!\n\nPlease enter your password to authenticate.", "Login", "Cancel");
}
else
{
new name[24], Escape[2][128];
GetPlayerName(playerid, name, 24);
mysql_real_escape_string(name, Escape[0]); // This function makes sure you don't get MySQL injected. Read about it by searching it on ******.
mysql_real_escape_string(inputtext, Escape[1]);
format(Query, sizeof(Query), "SELECT * FROM phpbb_users WHERE username = '%s' AND user_password = md5('%s')", Escape[0], Escape[1]);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows())
{
PlayerStats[playerid][pAuth] = 1;
LoadAccountVariables(playerid);
format(string, sizeof(string), "|- Welcome, %s! You have successfully logged in! -|", GetName(playerid));
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
TogglePlayerSpectating(playerid, false);
SetSpawnInfo(playerid, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
// -----[Let's Show Some TD's]----- //
TextDrawShowForPlayer(playerid, Textdraw0);
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Incorrect password. Please try again!");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login / Authentication Process", "Hello there!\n\nPlease enter your password to authenticate.", "Login", "Cancel");
}
}
}
Thanks,
Ryan