26.07.2012, 18:47
Hello,
whats wrong with this code?
it puts no data in tables plus players can login with INVALID password.
whats wrong with this code?
pawn Код:
switch( dialogid )
{
case Register:
{
new
Query[900],
EscPass[100],
EscName[MAX_PLAYER_NAME],
IP[16];
GetPlayerIp(playerid,IP,sizeof(IP));
mysql_real_escape_string(GetPName(playerid), EscName);
mysql_real_escape_string(inputtext, EscPass);
format(Query, sizeof(Query), "INSERT INTO `playerdata` (User, Password, Cash, Level, EXP, Rank, TurfsCaptured, TurfsLost, Kills, Deaths, Score, Muted, Warnings, Vip, IP) VALUES('%s', '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '%s')", EscName,EscPass, IP);
mysql_query(Query);
PInfo[playerid][Regged] = 1;
PInfo[playerid][Logged] = 1;
TogglePlayerSpectating(playerid, 0);
SendClientMessage(playerid,COLOR_ORANGE,"[*]: You Have Successfully Registered!");
}
case Login:
{
if(response)
{
new query[90], pname[24], escapepass[100];
GetPlayerName(playerid, pname, 24);
mysql_real_escape_string(inputtext, escapepass);
format(query, sizeof(query), "SELECT `User` FROM `playerdata` WHERE `User` = '%s' AND Password = '%s'", pname, escapepass);
mysql_store_result();
TogglePlayerSpectating(playerid, 0);
new numrows = mysql_num_rows();
if(numrows == 1) MySQL_Login(playerid);
if(!numrows)
{
ShowPlayerDialog(playerid, Login, DIALOG_STYLE_INPUT,""COL_LIGHTBLUE":: "COL_RED"Login", "\t"COL_WHITE"Consipirational Team Death Match (V1.0)\n"COL_RED"You Have Entered Invalid Password\n"COL_WHITE"Welcome Back, \nPlease Enter Your Password Below To Start The Game!", "Login", "Exit");
}
mysql_free_result();
}
}
}
return 1;
}