register login system clueless....
#1

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]);


}
}
Reply
#2

Guys please
Reply
#3

What is udb_encode ?
Reply
#4

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
Reply
#5

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.
Reply
#6

So.. any help?..
Reply
#7

I don't need help^^
Reply
#8

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

This is my problem. not yours!
Reply
#9

Well what "doesnt work" about it? what errors?
Reply
#10

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)