14.08.2012, 18:57
Hello, im having a bug with my login system. The registration dialog works fine creates the files and contents etc but when going back into the server and having to login it Always says its wrong password
Here is my dialogs(register/login)
Im using dini.
Here is my dialogs(register/login)
pawn Код:
if(dialogid == dregister)
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
return 1;
}
new hashpass[129];
new year, month, day, string[128];
new pname[MAX_PLAYER_NAME], path[200];
GetPlayerName(playerid, pname, sizeof(pname));
format(path, sizeof(path), "/Sfcnr/Users/%s.ini", pname);
getdate(year, month, day);
format(string, sizeof(string), "%02d/%02d/%d", day, month, year);
WP_Hash(hashpass,sizeof(hashpass),inputtext);
dini_Create(path);
dini_Set(path,"Ppassword",hashpass);
dini_Set(path, "Username", PlayerName(playerid));
dini_IntSet(path, "Score", 0);
dini_IntSet(path, "Money", 0);
dini_IntSet(path, "Bank_Money", 0);
dini_IntSet(path, "Stat", 0);
dini_IntSet(path, "Swat", 0);
dini_IntSet(path, "Army", 0);
dini_IntSet(path, "Admin_Level", 0);
dini_IntSet(path, "Cop_Level", 0);
dini_Set(path, "Register_date", string);
dini_IntSet(path, "Prison", 0);
dini_IntSet(path, "Vip_level", 0);
dini_IntSet(path, "Arrest_Level", 0);
dini_IntSet(path, "Taze_Level", 0);
dini_IntSet(path, "Rob_Level", 0);
dini_IntSet(path, "Rape_Level", 0);
dini_IntSet(path, "Heal_Level", 0);
dini_IntSet(path, "Hitman_Level", 0);
dini_IntSet(path, "Sales_Level", 0);
dini_IntSet(path, "Weapon_Level", 0);
dini_IntSet(path, "Drug_Level", 0);
dini_IntSet(path, "Trucking_Level", 0);
SendClientMessage(playerid,COLOR_GREEN,"You have been successfully registered");
}
}
if(dialogid == dlogin)
{
if(!response) return Kick(playerid);
if(response)
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(strcmp(hashpass,PlayerInfo[playerid][Ppassword]))
{
SetPlayerScore(playerid, dini_Int(Path(playerid), "Score"));
GivePlayerMoney(playerid,dini_Int(Path(playerid), "Money"));
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
return 1;
}
else if(!strcmp(hashpass,PlayerInfo[playerid][Ppassword]))
{
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
return 1;
}
}
}