26.03.2011, 02:37
I shut off my server after I learned that anyone can access anyone's account. Say if I type into the dialog: "Pogfdgshnih" it'll log me in. (No, that is not my password). Can anyone help?
My login dialog:
Sorry for the indentions, blame the forums.
pawn Код:
enum gPInfo
{
Password[256]
};
pawn Код:
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME], file[128], string[150];
GetPlayerName(playerid,name,sizeof(name));
Login(playerid,name);
return 1;
}
pawn Код:
stock Login(playerid,name[])
{
new file[64],n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,sizeof(n));
format(file,128,SERVER_USER_FILE,n);
INI_ParseFile(file,"Stats", .bExtra = true, .extra = playerid);
return 1;
}
pawn Код:
forward Stats(playerid, name[], value[]);
public Stats(playerid, name[], value[])
{
if(!strcmp(name,"Password"))
{
format(PInfo[playerid][Password],256,"%s",value);
}
return 1;
}
pawn Код:
else if(dialogid == 2)
{
new name[MAX_PLAYER_NAME],file[128],string[70],buf[129];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),SERVER_USER_FILE,name);
if(!response) return Kick(playerid);
WP_Hash(buf,sizeof(buf),inputtext);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Type your password below", "Login", "Quit");
if(strcmp(buf,PInfo[playerid][Password],true))
{
PInfo[playerid][Logged] = 1;
PInfo[playerid][Regged] = 1;
if(PInfo[playerid][Level] == 0) SendClientMessage(playerid,limegreen,"You have logged in as a Normal Player");
if(PInfo[playerid][Level] == 1) SendClientMessage(playerid,limegreen,"You have logged in as a Level 1 Admin");
if(PInfo[playerid][Level] == 2) SendClientMessage(playerid,limegreen,"You have logged in as a Level 2 Admin");
if(PInfo[playerid][Level] == 3) SendClientMessage(playerid,limegreen,"You have logged in as a Level 3 Admin");
if(PInfo[playerid][Level] == 4) SendClientMessage(playerid,limegreen,"You have logged in as a Level 4 Admin");
if(PInfo[playerid][Level] == 5) SendClientMessage(playerid,limegreen,"You have logged in as a Level 5 Admin");
if(PInfo[playerid][Level] == 6) SendClientMessage(playerid,limegreen,"You have logged in as a Level 6 Admin (Scripter)");
if(PInfo[playerid][Level] == 7) SendClientMessage(playerid,limegreen,"You have logged in as a Level 7 Admin (Owner)");
format(string,sizeof(string),"[Donor Level %d]",PInfo[playerid][VIP]);
SendClientMessage(playerid,limegreen,string);
}
else
{
SendClientMessage(playerid, RED, "Incorrect Password!");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Type your password below", "Login", "Quit");
}
}