Login system not working.
#1

So I've attempted to create a login system without the use of tutorials, etc. And I've encountered an issue.

The issue is when you connect and login with any password it successfully logs you in when it obviously shouldn't. Can anyone spot the issue? I've spent hours trying to nerrow it down, debugging every aspect and it still doesn't work. I even temporarily removed my hashing method(s) - being udbhash and whirlpool.

pawn Код:
if(dialogid == REGISTER_LOGIN)
    {
        if(!response) return Kick(playerid);
        if(!strlen(inputtext))
        {
            ShowPlayerDialog(playerid, REGISTER_LOGIN, DIALOG_STYLE_INPUT, "NO INPUT DETECTED", "Please enter your password to login.", "Enter", "Quit");
            return 1;
        }
        if(response)
        {
            if(!strcmp(inputtext, pInfo[playerid][pPass]))
            {
                INI_ParseFile(UserPath(playerid), "LoadUser", .bExtra = true, .extra = playerid);
                SCM(playerid,COLOR_GREEN, "You've successfully logged in.");
                return 1;
            }
            else
            {
                ShowPlayerDialog(playerid, REGISTER_LOGIN, DIALOG_STYLE_INPUT, "WRONG PASSWORD", "Please enter your password to login.", "Enter", "Quit");
                return 1;
            }
        }
    }
That is what happens when they login. If you need any other code, you know where to ask. Thanks.
Reply
#2

What you did is absolutely not true, when you are checking if the player has a time suck, then how thfump know the password of the player if she has not sucked.
PHP код:
if(fexist(PlayerFile(playerid)))
{
    
ShowPlayerDialog... Login
    INI_ParseFile
(UserPath(playerid), "LoadUser", .bExtra true, .extra playerid);
} else {
    
ShowPlayerDialog... Register

Reply
#3

1. Uh, what?

2. I've done all of that under onplayer connect which works perfectly.
Reply
#4

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
1. Uh, what?

2. I've done all of that under onplayer connect which works perfectly.
So it really does not work for you, then how "the system" will know what the player's password if it has not sucked.
Reply
#5

Код:
if(!strcmp(inputtext, pInfo[playerid][pPass]),false,strlen(inputtext))
            {
                INI_ParseFile(UserPath(playerid), "LoadUser", .bExtra = true, .extra = playerid);
                SCM(playerid,COLOR_GREEN, "You've successfully logged in.");
                return 1;
            }
Reply
#6

Quote:
Originally Posted by Rittik
Посмотреть сообщение
Код:
if(!strcmp(inputtext, pInfo[playerid][pPass]),false,strlen(inputtext))
            {
                INI_ParseFile(UserPath(playerid), "LoadUser", .bExtra = true, .extra = playerid);
                SCM(playerid,COLOR_GREEN, "You've successfully logged in.");
                return 1;
            }
pawn Код:
if(!strcmp(inputtext, pInfo[playerid][pPass]),false,strlen(inputtext))
The ignore case (false) and length (strlen) are optional parameters, so this will not work.
I think you have not loaded or saved the password correctly also check the .ini file, is the password correctly placed on it? (whats time suck?)
Reply
#7

Quote:
Originally Posted by SyntaxQ
Посмотреть сообщение
pawn Код:
if(!strcmp(inputtext, pInfo[playerid][pPass]),false,strlen(inputtext))
The ignore case (false) and length (strlen) are optional parameters, so this will not work.
I think you have not loaded or saved the password correctly also check the .ini file, is the password correctly placed on it? (whats time suck? lol)
Bunch of children trolling is what it is.

And the passwords do write properly (hashed and unhashed). Would you like to see my saving and loading functions/callbacks?
Reply
#8

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
Bunch of children trolling is what it is.

And the passwords do write properly (hashed and unhashed). Would you like to see my saving and loading functions/callbacks?
Yeah, I would like to see how you save and load.
Reply
#9

Quote:
Originally Posted by SyntaxQ
Посмотреть сообщение
Yeah, I would like to see how you save and load.
As requested.

pawn Код:
stock SaveUser(playerid)
{
    new path[50], name[MAX_PLAYER_NAME], Float:x, Float:y, Float:z;
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerPos(playerid, x, y, z);
    format(path,sizeof(path), "Users/%s.ini",name);
    new INI:file = INI_Open(path);
    INI_SetTag(file, "Player Data");
    //Writing
    //general
    INI_WriteInt(file,"pScore", GetPlayerScore(playerid));
    INI_WriteInt(file,"pSkin", GetPlayerSkin(playerid));
    //pos saving
    INI_WriteFloat(file,"pLastX", x);
    INI_WriteFloat(file,"pLastY", y);
    INI_WriteFloat(file,"pLastZ", z);

    //vehicles
    INI_WriteInt(file,"pVehicleID", pInfo[playerid][pVehicleID]);
    INI_WriteInt(file,"pVehicleColor1", pInfo[playerid][pVehicleColor1]);
    INI_WriteInt(file,"pVehicleColor2", pInfo[playerid][pVehicleColor2]);
    INI_WriteInt(file,"pVehicleRegistered", pInfo[playerid][pVehicleRegistered]);

    //bizzes
    INI_WriteInt(file,"pOwnedBusiness", pInfo[playerid][pOwnedBusiness]);
    INI_Close(file);
    return 1;
}



//
public LoadUser(playerid, name[], value[])
{
    //general
    INI_String("pPass", pInfo[playerid][pPass], 50);
    INI_Int("pScore", pInfo[playerid][pScore]);
    INI_Int("pSkin", pInfo[playerid][pSkin]);
    //pos saving
    INI_Float("pLastX", pInfo[playerid][pLastX]);
    INI_Float("pLastY", pInfo[playerid][pLastY]);
    INI_Float("pLastZ", pInfo[playerid][pLastZ]);
   
    //vehicles
    INI_Int("pVehicleID", pInfo[playerid][pVehicleID]);
    INI_Int("pVehicleColor1", pInfo[playerid][pVehicleColor1]);
    INI_Int("pVehicleColor2", pInfo[playerid][pVehicleColor2]);
    INI_Int("pVehicleRegistered", pInfo[playerid][pVehicleRegistered]);
   
    //bizzes
    INI_Int("pOwnedBusiness", pInfo[playerid][pOwnedBusiness]);
    return 1;
}
Reply
#10

EDIT: Fixed the issue.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)