SA-MP Forums Archive
register login system clueless.... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: register login system clueless.... (/showthread.php?tid=217005)



register login system clueless.... - bartje01 - 26.01.2011

Hey guys. Got some problems here.

When I register with a name like Bartje, I can just register and login perfectly.
But When I register with a name like Bartje_Bartje so with a symbol in it my register login system doesn't work so well.

What could be the problem?

pawn Код:
if (dialogid == Register)
{
if (!dini_Exists(udb_encode(playername))) {
dini_Create(udb_encode(playername));
dini_IntSet(udb_encode(playername), "password", udb_hash(inputtext));
dini_IntSet(udb_encode(playername), "adminlevel", 0);
dini_IntSet(udb_encode(playername), "score", 0);
dini_IntSet(udb_encode(playername), "money", 0);
dini_IntSet(udb_encode(playername), "wantedlevel", 0);
dini_IntSet(udb_encode(playername), "cop", 0);
dini_IntSet(udb_encode(playername), "grove", 0);
dini_IntSet(udb_encode(playername), "InFaction", 0);

SendClientMessage(playerid, COLOR_YELLOW, "Account created");
ShowPlayerDialog(playerid, Login, DIALOG_STYLE_INPUT, "Login", "Fill in your password", "Login", "Cancel");
}
}
else

if (dialogid == Login)
{
if (dini_Exists(udb_encode(playername))) {
tmp2 = dini_Get(udb_encode(playername), "password");
if (udb_hash(inputtext) != strval(tmp2)) {
SendClientMessage(playerid, COLOR_RED, "Wrong password!");
ShowPlayerDialog(playerid, Login, DIALOG_STYLE_INPUT, "Login", "Fill in your password", "Login", "Cancel");
}
else {
logged[playerid] = 1;
money[playerid] = dini_Int(udb_encode(playername), "money");
wantedlevel[playerid] = dini_Int(udb_encode(playername), "wantedlevel");
adminlevel[playerid] = dini_Int(udb_encode(playername), "adminlevel");
score[playerid] = dini_Int(udb_encode(playername), "score");
InFaction[playerid] = dini_Int(udb_encode(playername), "InFaction");
cop[playerid] = dini_Int(udb_encode(playername), "cop");
grove[playerid] = dini_Int(udb_encode(playername), "grove");
SendClientMessage(playerid, COLOR_GREEN, "Succesfully logged in!");
GivePlayerMoney(playerid, money[playerid]);
SetPlayerWantedLevel(playerid, wantedlevel[playerid]);


}
}



Re: register login system clueless.... - bartje01 - 27.01.2011

Guys please


Re: register login system clueless.... - PeteShag - 27.01.2011

What is udb_encode ?


Re: register login system clueless.... - coole210 - 27.01.2011

Quote:
Originally Posted by PeteShag
Посмотреть сообщение
What is udb_encode ?
A dudb function to encrypt passwords etc.

EDIT: I think xD I use mysql now so im clueless @ dudb


Re: register login system clueless.... - BMUK - 27.01.2011

Quote:
Originally Posted by coole210
Посмотреть сообщение
A dudb function to encrypt passwords etc.

EDIT: I think xD I use mysql now so im clueless @ dudb
It changes symbols in the playername string. Nothing to do with securing passwords.


Re: register login system clueless.... - bartje01 - 27.01.2011

So.. any help?..


Re: register login system clueless.... - =SR=Tony - 27.01.2011

I don't need help^^


Re: register login system clueless.... - bartje01 - 27.01.2011

Quote:
Originally Posted by =SR=Tony
Посмотреть сообщение
I don't need help^^
Omfg dude. Sorry but. Are you?..

This is my problem. not yours!


Re: register login system clueless.... - BMUK - 27.01.2011

Well what "doesnt work" about it? what errors?


Re: register login system clueless.... - Grim_ - 27.01.2011

There are a few (potential) problems I see.

1. You don't create an extension. I'm not sure how udb_encode works, but there may be problems when attempting to create a file with what it returns that doesn't contain an extension. Not having an extension may be the problem itself too! Though, I'm uncertain since I've never done so. You should create a new string to hold the filename and extension, and create/write/read from that. And example:
pawn Код:
new string[ 80 ];
format( string, sizeof( string ), "%s.ini", udb_encode( playername ) );
dini_Create( string );
dini_IntSet( string, "blah", 1 );
2. There could be something wrong with the way you are using the udb_encode function. Once again, I am unfamiliar with it, so can't make accurate judgments yet. If you could paste the code, I could assist you further, hopefully (try solution #1 first, though)