PHP Code:
switch(dialogid)
{
case dLOGIN: //login dialog
{
if(!response) Kick(playerid); //if they clicked Quit, we will kick them
new hpass[129]; //for password hashing
new query[100]; // for formatting our query.
WP_Hash(hpass, 129, inputtext); //hashing inputtext
if(!strcmp(hpass, pData[playerid][Password])) //remember we have loaded player's password into this variable, pData[playerid][Password] earlier. Now let's use it to compare the hashed password with password that we load
{
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `Username` = '%e' LIMIT 1", pName(playerid));
mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
}
else //if the hashed password didn't match with the loaded password(pData[playerid][Password])
{
ShowPlayerDialog(playerid, dLOGIN, DIALOG_STYLE_INPUT, "Login", "In order to play, you need to login\nWrong password!", "Login", "Quit");
new tmp[3000],str[3000];
pInfo[playerid][WrongPass]++;
format(tmp, sizeof(tmp), "9,2%s (ID: %d) tried to login using a wrong password", playerid);
IRC_GroupSay(groupID, IRC_aCHANNEL, tmp);
IRC_GroupSay(groupID, IRC_CHANNEL, tmp);
format(str, sizeof(str), "ZoneX: %s (ID: %d) tried to login using a wrong password", playerid);
SendClientMessage(playerid, COLOR_RED, str);
}
if(pInfo[playerid][WrongPass] == 3)
{
new tmp[3000],str[3000];
pInfo[playerid][WrongPass] = 0;
format(tmp, sizeof(tmp), "9,2%s (ID: %d) has been kicked due to using many wrong password.", GetName(playerid), playerid);
IRC_GroupSay(groupID, IRC_aCHANNEL, tmp);
IRC_GroupSay(groupID, IRC_CHANNEL, tmp);
format(str, sizeof(str), "ZoneX: %s (ID: %d) has been kicked due to using many wrong password.", GetName(playerid), playerid);
SendClientMessageToAll(COLOR_RED, str);
Kick(playerid);
}
}
Code:
[15:25:31] [debug] Run time error 3: "Stack/heap collision (insufficient stack size)"
[15:25:31] [debug] Stack pointer (STK) is 0x50F29C, heap pointer (HEA) is 0x51142C
[15:25:31] [debug] AMX backtrace:
[15:25:31] [debug] #0 00000000 in public OnDialogResponse ()