Fix BUgs register bugs
#1

SUP FIX THIS FOR MEE PLZ

Quote:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[256],query[256],escpass[256],PIP[56],LastLogin[128];

new Hour, Minute, Second, Year, Month, Day;

GetPlayerIp(playerid, PIP, sizeof(PIP)); //Gets the players IP

gettime(Hour, Minute, Second);
getdate(Year, Month, Day);

format(LastLogin, sizeof(LastLogin), "DATE: %d-%d-%d TIME: %d:%d",Day,Month,Year,Hour,Minute);


if(dialogid == DIALOG_REGISTER)
{

if(response == 1)
{
if(!strlen(inputtext)) //If the player doesn't enter a pass
{
format(string, sizeof(string), "Cops And Robbers\n \nNew Registration - Name: %s\n \nDo Not Register Multiple Accounts\nDo Not Use The Same Password That You Use Elsewhere\nMinimum 6 Chars Maximum 12 Chars\n \nPlease Enter A Password For Your Account:",PlayerInfo[playerid][pName],playerid);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT , "CnR Registration",string, "Register", "Cancel");
return 1;
}

if(strlen(inputtext) < 6)
{
SendClientMessage(playerid, COLOR_ERROR, "Your Password is Too Short, Enter a Longer Password.");

format(string, sizeof(string), "Cops And Robbers\n \nNew Registration - Name: %s\n \nDo Not Register Multiple Accounts\nDo Not Use The Same Password That You Use Elsewhere\nMinimum 6 Chars Maximum 12 Chars\n \nPlease Enter A Password For Your Account:",PlayerInfo[playerid][pName],playerid);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT , "CnR Registration",string, "Register", "Cancel");
return 1;
}

if(strlen(inputtext) > 12)
{
SendClientMessage(playerid, COLOR_ERROR, "Your Password is Too Long, Enter a Shorter Password.");

format(string, sizeof(string), "Cops And Robbers\n \nNew Registration - Name: %s\n \nDo Not Register Multiple Accounts\nDo Not Use The Same Password That You Use Elsewhere\nMinimum 6 Chars Maximum 12 Chars\n \nPlease Enter A Password For Your Account:",PlayerInfo[playerid][pName],playerid);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT , "CnR Registration",string, "Register", "Cancel");
return 1;
}


mysql_real_escape_string(inputtext, escpass);

//mysql_real_escape_string(PlayerInfo[playerid][pName],PlayerInfo[playerid][pName]);
//mysql_real_escape_string(inputtext,inputtext);

format(query, sizeof(query), "INSERT INTO playerdata (UserName, Password, IP) VALUES('%s', SHA1('%s'), '%s')", PlayerInfo[playerid][pName], escpass, PIP);
mysql_query(query);

format(query, sizeof(query), "INSERT INTO playerdata (UserName, Password, IP) VALUES ('%s', md5('%s'), '%s')",PlayerInfo[playerid][pName], inputtext, PIP); //Insert string
mysql_query(query);

//format(query,sizeof(query),"UPDATE playerdata SET Registered = '%s' WHERE (UserName = '%s')",LastLogin,PlayerInfo[playerid][pName]);
//mysql_query(query); //queries

format(query,sizeof(query),"UPDATE playerdata SET LastLogin = '%s' WHERE (UserName = '%s')",LastLogin,PlayerInfo[playerid][pName]);
mysql_query(query); //queries

mysql_free_result();

PlayerInfo[playerid][pLogged] = 1;
PlayerInfo[playerid][pRegistered] = 1;
//SendClientMessage(playerid, COLOR_SERVER_MAIN_MSG, "Registered And Logged In.");

SendClientMessage(playerid, COLOR_SERVER_MAIN_MSG, "New Account Created. Your Are Now Logged In. ");//Please Read The Registration Info.
SendClientMessage(playerid, COLOR_SERVER_MAIN_MSG, "Type /help and /commands For Game Information, or visit "WEBSITE"");


}else{//End Of Response Check
SendClientMessage(playerid, COLOR_SERVER_MAIN_MSG, "{FFFFFF}Registration {FF0000}Cancelled.");
}

}//End Of DialogCheck


if(dialogid == DIALOG_LOGIN)
{

if(response == 1)
{

mysql_real_escape_string(inputtext, escpass); //We escape the inputtext to avoid SQL injections.
format(query, sizeof(query), "SELECT * FROM playerdata WHERE UserName = '%s' AND Password = SHA1('%s')", PlayerInfo[playerid][pName], escpass);
mysql_query(query);
mysql_store_result();

if(mysql_num_rows() > 0)
{

new wdata[256],Locked;

format(query,sizeof(query),"SELECT * FROM playerdata WHERE UserName = '%s' LIMIT 1",PlayerInfo[playerid][pName]);
mysql_query(query);
mysql_store_result();

while(mysql_retrieve_row()) //it will be running until there are no more rows to be retrieved
{

mysql_get_field("Locked",wdata); //macro for mysql_fetch_field_row
Locked = strval(wdata);

Reply
#2

Not unless you ask nicely!
Reply
#3

Jesus christ, learn to indent!
Reply
#4

can somebody help mee ?
Reply
#5

nobody dont want to fix it
Reply
#6

i was know this
Reply
#7

Quote:
Originally Posted by gekas
Посмотреть сообщение
can somebody help mee ?
Quote:
Originally Posted by gekas
Посмотреть сообщение
nobody dont want to fix it
Quote:
Originally Posted by gekas
Посмотреть сообщение
i was know this
Yay, keep bumping your thread because that's not against the forum rules or anything!

And nobody wants to help fix your code when you can't even indent properly, or read the forum rules!
Reply
#8

ok ok :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)