[INI Problem] Password don't save
#1

Hello, I've trying since last night to fix a bug. The passwords when you register, doesn't save. Don't insert any value.

Parts of code which may contain the bug:
pawn Код:
function OnPlayerRegister(playerid, inputtext[])
{
    if(IsPlayerConnected(playerid))
    {
        new passita[24];
        new INI:File = INI_Open(UserPath(playerid));
        INI_SetTag(File,"data");
        format(passita, sizeof(passita), "%s", inputtext);
        printf(passita);
        INI_WriteString(File,"Password", passita); //udb INI_WriteInt(File,"Password",udb_hash(password));
        INI_Close(File);
        TotalRegister++;
        SendClientMessageEx(playerid, COLOR_YELLOW, "Cuenta registrada, se ha iniciado sesiуn automбticamente.");
        OnPlayerLogin(playerid);
    }
    return 1;
}
pawn Код:
function LoadUser_pass(playerid,name[],value[])
{
    //INI_Int("Password",Info[playerid][pKey]);
    INI_String("Password",Info[playerid][pKey], 24);
    return 1;
}
pawn Код:
INI_WriteString(File,"Password",Info[playerid][pKey]);
Or this:
pawn Код:
if( strcmp( key , "Key" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(Info[playerid][pKey], val, 0, strlen(val)-1, 24); }
Heeelp please D:
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
Please don't write your own login system unless you REALLY know what you're doing, which I can tell you don't. There is too much at stake with regards to user security.
This isn't for a server, is for learning, therefore I ask for help
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
I still think my statement stands - there are hundreds of non-critical systems you can write to learn through, this isn't one.
What do you mean? It makes no sense what you're saying, I am wondering how to fix a bug in a system, and you come to tell me that if I'm going to compromising safety of users and others, when you don't know why I need this code. If you're going to post useless things, better not comment.
Reply
#4

If you need that code for anything at all, ******' statement still stands. Hash your passwords or god forbid if anyone finds out.

If you're going to learn, learn the right way. Use Whirlpool, or udb_hash or SOMETHING. (Preferably Whirlpool)

And just so you know:
pawn Код:
function LoadUser_pass(playerid,name[],value[])
Should be:
pawn Код:
function LoadUser_data(playerid, name[], value[])
Look over the y_ini tutorial thread next time, you would have easily found the error.
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Please don't write your own login system unless you REALLY know what you're doing, which I can tell you don't. There is too much at stake with regards to user security.

@****** at least let him try to make his own register/login system ,you should motivate him instead of demotivating him.As far as I know he is a newbie in scripting, and he needs some special assistance from all the good coders/scripters like you. Do not take this post to your heart. I am just posting this as a forum member of this community.
No Offense
Reply
#6

As a 'forum member of this community' (?), you should know that user security is the main priority of all developers and is definitely something we should be assuring players of.

The last thing you want to do is promote wrongdoings, especially if they are against personal security. The only thing that ****** is 'demotivating him' from doing is the wrong thing, and that's why I'm trying to get ******' back here, because I completely agree with him.

The last thing you want to do when you join a server is hand over your password for everything directly to the server owner. We have given him the assistance he needs to get on his way, all he has to do now is listen.
Reply
#7

I highly recommend you to read several tutorials about how to make a registration system before trying to make one yourself.
Reply
#8

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
If you need that code for anything at all, ******' statement still stands. Hash your passwords or god forbid if anyone finds out.

If you're going to learn, learn the right way. Use Whirlpool, or udb_hash or SOMETHING. (Preferably Whirlpool)

And just so you know:
pawn Код:
function LoadUser_pass(playerid,name[],value[])
Should be:
pawn Код:
function LoadUser_data(playerid, name[], value[])
Look over the y_ini tutorial thread next time, you would have easily found the error.
Okay, thanks, would it look like this?
pawn Код:
function LoadUser_data(playerid,name[],value[])
{
    /* added */INI_String("Password",Ino[playerid][pKey], 24); // Taken from LoadUser_pass
    INI_Int("Level",Info[playerid][pLevel]);
    INI_Int("ADMLvl",Info[playerid][pAdminZC]);
    INI_Int("AdminZC",Info[playerid][pLvlAdminZC]);
    INI_Int("BanAppealer",Info[playerid][pBanAppealer]);
    INI_Int("FactionModerator",Info[playerid][pFactionModerator]);
    INI_Int("GangModerator",Info[playerid][pGangModerator]);
    INI_Int("Helper",Info[playerid][pHelper]);
    INI_Int("ConnectedTime",Info[playerid][pConnectTime]);
    INI_Int("Registered",Info[playerid][pReg]);
    INI_Int("Sex",Info[playerid][pSex]);
    INI_Int("Age",Info[playerid][pAge]);
    INI_Int("Origin",Info[playerid][pOrigin]);
    INI_Int("Respect",Info[playerid][pExp]);
    INI_Int("Money",Info[playerid][pCash]);
    SetPVarInt(playerid, "Cash",Info[playerid][pCash]);
    INI_Int("Bank",Info[playerid][pAccount]);
    INI_String("IP", Info[playerid][pIP], 32);
    INI_Int("Kills",Info[playerid][pKills]);
    INI_Int("Deaths",Info[playerid][pDeaths]);
return 0;
}
And should I change this on login?
pawn Код:
/*From INI_ParseFile(UserPath(playerid), "LoadUser_pass", .bExtra = true, .extra = playerid);*/
/* into */
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
ї?
But I still think that the problem is here:
pawn Код:
function OnPlayerRegister(playerid, inputtext[])
{
    if(IsPlayerConnected(playerid))
    {
        new passita[24];
        new INI:File = INI_Open(UserPath(playerid));
        INI_SetTag(File,"data");
        format(passita, sizeof(passita), "%s", inputtext);
        printf(passita);
        INI_WriteString(File,"Password", passita); //udb INI_WriteInt(File,"Password",udb_hash(password));
        INI_Close(File);
        TotalRegister++;
        SendClientMessageEx(playerid, COLOR_YELLOW, "Cuenta registrada, se ha iniciado sesiуn automбticamente.");
        OnPlayerLogin(playerid);
    }
    return 1;
}
Thanks.
Reply
#9

pawn Код:
function LoadUser_data(playerid,name[],value[])
{
   //INI_String("Password",Ino[playerid][pKey], 24); // Taken from LoadUser_pass
    INI_Int("Password",Info[playerid][playerid][pKey]); // It should be INI_Int not string.
    INI_Int("Level",Info[playerid][pLevel]);
    INI_Int("ADMLvl",Info[playerid][pAdminZC]);
    INI_Int("AdminZC",Info[playerid][pLvlAdminZC]);
    INI_Int("BanAppealer",Info[playerid][pBanAppealer]);
    INI_Int("FactionModerator",Info[playerid][pFactionModerator]);
    INI_Int("GangModerator",Info[playerid][pGangModerator]);
    INI_Int("Helper",Info[playerid][pHelper]);
    INI_Int("ConnectedTime",Info[playerid][pConnectTime]);
    INI_Int("Registered",Info[playerid][pReg]);
    INI_Int("Sex",Info[playerid][pSex]);
    INI_Int("Age",Info[playerid][pAge]);
    INI_Int("Origin",Info[playerid][pOrigin]);
    INI_Int("Respect",Info[playerid][pExp]);
    INI_Int("Money",Info[playerid][pCash]);
    SetPVarInt(playerid, "Cash",Info[playerid][pCash]);
    INI_Int("Bank",Info[playerid][pAccount]);
    INI_String("IP", Info[playerid][pIP], 32);
    INI_Int("Kills",Info[playerid][pKills]);
    INI_Int("Deaths",Info[playerid][pDeaths]);
return 0;
}
Aswell as the other code.
pawn Код:
INI_WriteInt(passita,"Password",data here);
Reply
#10

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
pawn Код:
function LoadUser_data(playerid,name[],value[])
{
   //INI_String("Password",Ino[playerid][pKey], 24); // Taken from LoadUser_pass
    INI_Int("Password",Info[playerid][playerid][pKey]); // It should be INI_Int not string.
    INI_Int("Level",Info[playerid][pLevel]);
    INI_Int("ADMLvl",Info[playerid][pAdminZC]);
    INI_Int("AdminZC",Info[playerid][pLvlAdminZC]);
    INI_Int("BanAppealer",Info[playerid][pBanAppealer]);
    INI_Int("FactionModerator",Info[playerid][pFactionModerator]);
    INI_Int("GangModerator",Info[playerid][pGangModerator]);
    INI_Int("Helper",Info[playerid][pHelper]);
    INI_Int("ConnectedTime",Info[playerid][pConnectTime]);
    INI_Int("Registered",Info[playerid][pReg]);
    INI_Int("Sex",Info[playerid][pSex]);
    INI_Int("Age",Info[playerid][pAge]);
    INI_Int("Origin",Info[playerid][pOrigin]);
    INI_Int("Respect",Info[playerid][pExp]);
    INI_Int("Money",Info[playerid][pCash]);
    SetPVarInt(playerid, "Cash",Info[playerid][pCash]);
    INI_Int("Bank",Info[playerid][pAccount]);
    INI_String("IP", Info[playerid][pIP], 32);
    INI_Int("Kills",Info[playerid][pKills]);
    INI_Int("Deaths",Info[playerid][pDeaths]);
return 0;
}
But the password isn't hashed, wouldn't it be a string?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)