Dialog System without hash
#1

All the register/login systems ive found while searching uses a hash for the password, but im kind of evil so I dont want hashed passwords in the user file. I made my own register/login dialog system with Dini but as always I get errors with inputtext.

I always get these errors while trying to make a register/login system without hash.

Can someone help me fix them?

Error:
Code:
C:\Server\gamemodes\test.pwn(120) : error 035: argument type mismatch (argument 3)
Row (under register dialog):
pawn Code:
dini_IntSet(file, "password", inputtext);

Error:
Code:
C:\Server\gamemodes\test.pwn(144) : error 033: array must be indexed (variable "inputtext")
Rows (under logindialog):
pawn Code:
(142)if(strlen(inputtext))
(143){
(144)    if(inputtext != dini_Int(file, "password"))
(145)    {
(146)        ShowPlayerDialog(playerid, 1336, DIALOG_STYLE_PASSWORD, "Login", "Wrong password!", "Login", "Cancel");
(147)    }
(148)    else
(149)    {
(150)        //Log in the player
(151)    }
Reply
#2

One does not simply store unhashed passwords! Furthermore, strings are compared through strcmp.
Reply
#3

Quote:
Originally Posted by Vince
View Post
One does not simply store unhashed passwords! Furthermore, strings are compared through strcmp.
I see what you did there!
But I have no idea how to use it outside commands and under dialogresponse, could you help me out with that?
Reply
#4

pawn Code:
if(!strcmp(inputtext, dini_Get(file, "password")))
{
    // correct password
}
else
{
    // incorrect password
}
P.S. You MUST hash passwords, it's bad not to.
Reply
#5

Quote:
Originally Posted by MP2
View Post
pawn Code:
if(!strcmp(inputtext, dini_Get(file, "password")))
{
    // correct password
}
else
{
    // incorrect password
}
P.S. You MUST hash passwords, it's bad not to.
I always hash passwords on my main server but this server is just for test and reference.
Reply
#6

Other error? Other error.

Code:
C:\Server\gamemodes\test.pwn(118) : error 035: argument type mismatch (argument 3)
Code:
pawn Code:
(109)if(dialogid == REGISTER)
(110){
(111)    new file[128], name[24], str[128];
(112)    GetPlayerName(playerid, name, sizeof(name));
(113)    format(file, sizeof(file), "/users/%s.ini", name);
(114)        
(115)    if(response)
(116)    {
(117)        dini_Create(file);
(118)        dini_IntSet(file, "password", inputtext); //<-- THIS
(119)        dini_IntSet(file, "level", pInfo[playerid][Level]);
(120)        dini_IntSet(file, "kills", pInfo[playerid][Kills]);
(121)        dini_IntSet(file, "deaths", pInfo[playerid][Deaths]);
(122)        dini_IntSet(file, "score", GetPlayerScore(playerid));
(123)        dini_IntSet(file, "money", GetPlayerMoney(playerid));
(124)        format(str, sizeof(str), "Server: Registered.", name);
(125)        SendClientMessage(playerid, 0xFFFF00FF, str);
(126)    }
(127)}
Reply
#7

Your using dini_IntSet for a string when it should only be used for ints.

It should be dini_StringSet (or what ever the dini function is to set strings)
Reply
#8

pawn Code:
(118)        dini_IntSet(file, "password", inputtext); //<-- THIS
The third parameter is supposed to be an integer. "inputtext" is a string.
Reply
#9

Quote:
Originally Posted by iggy1
View Post
Your using dini_IntSet for a string when it should only be used for ints.

It should be dini_StringSet (or what ever the dini function is to set strings)
Ah I knew it was something like that!

Rep for you my friend!

EDIT: There was no dini_StringSet but I suppose dini_Set will work instead
Reply
#10

:S

No idea if you already succeded, if not, it's dini_Set(file, "password", inputtext);..
Reply
#11

:S

No idea if you already succeded, if not, it's dini_Set(file, "password", inputtext);..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)