Dialog System without hash -
[NWA]Hannes - 05.06.2012
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) }
Re: Dialog System without hash -
Vince - 05.06.2012
One does not simply store unhashed passwords! Furthermore,
strings are
co
mpared through strcmp.
Re: Dialog System without hash -
[NWA]Hannes - 05.06.2012
Quote:
Originally Posted by Vince
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?
Re: Dialog System without hash -
MP2 - 05.06.2012
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.
Re: Dialog System without hash -
[NWA]Hannes - 05.06.2012
Quote:
Originally Posted by MP2
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.
Re: Dialog System without hash -
[NWA]Hannes - 05.06.2012
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)}
Re: Dialog System without hash -
iggy1 - 05.06.2012
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)
Re: Dialog System without hash -
DaRealShazz - 05.06.2012
pawn Code:
(118) dini_IntSet(file, "password", inputtext); //<-- THIS
The third parameter is supposed to be an integer. "inputtext" is a string.
Re: Dialog System without hash -
[NWA]Hannes - 05.06.2012
Quote:
Originally Posted by iggy1
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
Re: Dialog System without hash -
ricardo178 - 05.06.2012
:S
No idea if you already succeded, if not, it's dini_Set(file, "password", inputtext);..
Re: Dialog System without hash -
ricardo178 - 05.06.2012
:S
No idea if you already succeded, if not, it's dini_Set(file, "password", inputtext);..