Login problem
#1

Hey guys.
Seems like an error occurred on my register/login system.

Code:
pawn Код:
dcmd_register(playerid, params[])
{
    if(dini_Exists(file) ||  pInfo[playerid][Logged] == 1)
        return SendClientMessage(playerid,Red,"ERROR: You are already registered/logged in.");
    else if(!params[0])
        return SendClientMessage(playerid,Red,"USAGE: /register [password]");
    else if(strlen(params) > 10 || strlen(params) < 4)
        return SendClientMessage(playerid,Red,"ERROR: Current password lengths are between 4 and 10.");

    else
    {
        new password = num_hash(params);
        dini_Create(file);
        pInfo[playerid][Password] = password;
        dini_IntSet(file, "Password", pInfo[playerid][Password]);
        SendClientMessage(playerid, Green,"You are successfuly registered,and logged in,thank you for registering,have fun!");
        pInfo[playerid][Logged] = 1;
    }
    return 1;
}
dcmd_login(playerid, params[])
{
    if(!dini_Exists(file))
        return SendClientMessage(playerid, Red, "ERROR: Please register before you try to login.");
    else if(pInfo[playerid][Logged] == 1)
        return SendClientMessage(playerid, Red, "ERROR: You are already logged-in.");
    else if(!params[0])
        return SendClientMessage(playerid, Red, "USAGE: /login [password]");
    else
    {
        new password = num_hash(params);
        if(pInfo[playerid][Password] == password)
        {
            pInfo[playerid][Logged] = 1;
            return SendClientMessage(playerid, lBlue, "You have successfully logged in to your account.");
        }
        else
        return SendClientMessage(playerid, Red, "ERROR: Incorrect password.");
    }
}
Indentation fucked up? Probably.

Anyway,after I register it successfully hashes the password,but when I try to log-in,it says incorrect password.

I hope you guys can help me solve this one!
Reply


Messages In This Thread
Login problem[SOLVED] - by [XST]O_x - 12.07.2010, 10:50
Re: Login problem - by cessil - 12.07.2010, 10:54
Re: Login problem - by [XST]O_x - 12.07.2010, 11:00
Re: Login problem - by oliverrud - 12.07.2010, 11:04
Re: Login problem - by [XST]O_x - 12.07.2010, 11:19
Re: Login problem - by novox - 12.07.2010, 11:29
Re: Login problem - by MadeMan - 12.07.2010, 12:24
Re: Login problem - by [XST]O_x - 12.07.2010, 12:25
Re: Login problem - by MadeMan - 12.07.2010, 12:33
Re: Login problem - by [XST]O_x - 12.07.2010, 12:47

Forum Jump:


Users browsing this thread: 1 Guest(s)