Whirlpool help :s
#1

Even tho if I type the correct password, it says wrong password, why?!
pawn Код:
if(dialogid == Logindialog)
    {
        if(!response) return Kick(playerid);
        new password[129],string[128],hashedpassword[129];
        format(file,sizeof(file),"FAdmin/Users/%s.ini",GetPName(playerid));
        INI_Open(file);
        INI_ReadString(hashedpassword,"Password");
        INI_Close();
        WP_Hash(password,129,inputtext);
        if(strcmp(hashedpassword,password) == 0)
        {
            LoadPlayerStats(playerid);
            PInfo[playerid][Regged] = true;
            PInfo[playerid][Logged] = 1;
        }
        else
        {
            PInfo[playerid][Failedlogins]++;
            format(string,sizeof(string),""cred"Attempts left: "cwhite"["corange"%i"cwhite"] \n"cwhite"Please type in your password to login",MAX_FAILED_LOGINS-PInfo[playerid][Failedlogins]);
            ShowPlayerDialog(playerid,Logindialog,1,"Login",string,"Login","");
            if(PInfo[playerid][Failedlogins] == MAX_FAILED_LOGINS)
            {
                format(string,sizeof(string),"%s has been kicked for %i failed logins",GetPName(playerid),MAX_FAILED_LOGINS);
                SendAdminMessage(red,string);
                Kick(playerid);
                SaveIn("Failedlogins",string,1);
            }
        }
        return 1;
    }
Reply
#2

Debug your code and see both password.
Reply
#3

Is the password typed into the input box the same as the one in the file (After hashing)? Use print on the whirlpool hash and compare it. It may be a problem with your saving function, not your loading one.
Reply
#4

Nop they aren't the same.
My register dialog
pawn Код:
if(dialogid == Registerdialog)
    {
        if(!response && SInfo[MustRegister] == 1) return Kick(playerid);
        else if(!response && SInfo[MustRegister] == 0) return 0;
        if(strlen(inputtext) < 3 || strlen(inputtext) > 20) return ShowPlayerDialog(playerid,Registerdialog,1,"Register",""cwhite"Please type in the "cred"desired "cwhite"password below \n"cred"More than 3 and less than 20 characters\n","Register","Cancel");
        new password[130];
        format(file,sizeof(file),"FAdmin/Users/%s.ini",GetPName(playerid));
        WP_Hash(password,130,inputtext);
        INI_Open(file);
        INI_WriteString("Password",password);
        INI_WriteInt("Money",GetPlayerMoney(playerid));
        INI_WriteInt("Score",GetPlayerScore(playerid));
        INI_WriteInt("ALevel",PInfo[playerid][Level]);
        INI_Save();
        INI_Close();
        LoadPlayerStats(playerid);
        PInfo[playerid][Regged] = true;
        PInfo[playerid][Logged] = 1;
        SendClientMessage(playerid,green2,"» You have successfully registered!");
    }
Reply
#5

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Nop they aren't the same.
My register dialog
pawn Код:
if(dialogid == Registerdialog)
    {
        if(!response && SInfo[MustRegister] == 1) return Kick(playerid);
        else if(!response && SInfo[MustRegister] == 0) return 0;
        if(strlen(inputtext) < 3 || strlen(inputtext) > 20) return ShowPlayerDialog(playerid,Registerdialog,1,"Register",""cwhite"Please type in the "cred"desired "cwhite"password below \n"cred"More than 3 and less than 20 characters\n","Register","Cancel");
        new password[130];
        format(file,sizeof(file),"FAdmin/Users/%s.ini",GetPName(playerid));
        WP_Hash(password,130,inputtext);
        INI_Open(file);
        INI_WriteString("Password",password);
        INI_WriteInt("Money",GetPlayerMoney(playerid));
        INI_WriteInt("Score",GetPlayerScore(playerid));
        INI_WriteInt("ALevel",PInfo[playerid][Level]);
        INI_Save();
        INI_Close();
        LoadPlayerStats(playerid);
        PInfo[playerid][Regged] = true;
        PInfo[playerid][Logged] = 1;
        SendClientMessage(playerid,green2,"» You have successfully registered!");
    }
pawn Код:
#define MAX_INI_ENTRY_TEXT 160//Before y_ini include
Reply
#6

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
#define MAX_INI_ENTRY_TEXT 160//Before y_ini include[/pawn]
Who said I'm using y_ini? o:
Reply
#7

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Who said I'm using y_ini? o:
Код:
INI_Open(file);
Your code does.
Reply
#8

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
Код:
INI_Open(file);
Your code does.
I'm using SII.
EDIT:
FIXED
Reply
#9

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Who said I'm using y_ini? o:
Then what is it?

EDIT: Oh, then find a similiar define inside your include.
Reply
#10

Can you print the values of the whirlpool hash when you type something in the register dialog and when you type something into the login dialog. This will determine if it's a saving issue or not.

EDIT: Nevermind, it was fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)