Login with any password bug -
Biess - 22.12.2012
pawn Код:
case DIALOG_LOGIN: {
if ( !response ) return Kick ( playerid );
if( response ) {
//if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
//if(strlen(PInfo[playerid][Password])) {
new file[64], PlayerName[24];
GetPlayerName(playerid,PlayerName,sizeof PlayerName);
format(file,sizeof file,"Admin/%s.ini",PlayerName);
if(strlen(inputtext[PInfo[playerid][Password]])) {
INI_Open(file);//Opening the file with SII include
INI_ReadString(inputtext[PInfo[playerid][Password]],"Password");
PInfo[playerid][Registered] = INI_ReadInt("Registered");
PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file.
PInfo[playerid][Score] = INI_ReadInt("Score"); // Setting the score of player
PInfo[playerid][Money] = INI_ReadInt("Money"); // Setting the money of player
PInfo[playerid][Operator] = INI_ReadInt("Operator");
INI_Close();//"Closing the file", that means that we're not using it anymore :P
SendClientMessage(playerid,-1,"You have been successfully logged in!");
PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
SetPlayerScore(playerid, PInfo[playerid][Score]);
GivePlayerMoney(playerid, PInfo[playerid][Money]);
} else {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
}
I have that code for the login. But the problem is
You can login with ANY password..
Re: Login with any password bug -
mineralo - 22.12.2012
you not checking if same password
pawn Код:
case DIALOG_LOGIN: {
if ( !response ) return Kick ( playerid );
if( response ) {
//if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
//if(strlen(PInfo[playerid][Password])) {
new file[64], PlayerName[24],pass[256];
GetPlayerName(playerid,PlayerName,sizeof PlayerName);
format(file,sizeof file,"Admin/%s.ini",PlayerName);
if(strlen(inputtext)) {
INI_Open(file);//Opening the file with SII include
INI_ReadString(pass,"Password");
if(strlcmp(pass,inputtext,true) !=0) {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
return 1;
}
PInfo[playerid][Registered] = INI_ReadInt("Registered");
PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file.
PInfo[playerid][Score] = INI_ReadInt("Score"); // Setting the score of player
PInfo[playerid][Money] = INI_ReadInt("Money"); // Setting the money of player
PInfo[playerid][Operator] = INI_ReadInt("Operator");
INI_Close();//"Closing the file", that means that we're not using it anymore :P
SendClientMessage(playerid,-1,"You have been successfully logged in!");
PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
SetPlayerScore(playerid, PInfo[playerid][Score]);
GivePlayerMoney(playerid, PInfo[playerid][Money]);
} else {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
}
Re: Login with any password bug -
mineralo - 22.12.2012
if you use any hash system then don't forget to convert inputtext and after check it
Re: Login with any password bug -
Biess - 22.12.2012
Quote:
Originally Posted by mineralo
you not checking if same password
pawn Код:
case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { //if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) //if(strlen(PInfo[playerid][Password])) { new file[64], PlayerName[24],pass[256]; GetPlayerName(playerid,PlayerName,sizeof PlayerName); format(file,sizeof file,"Admin/%s.ini",PlayerName); if(strlen(inputtext)) { INI_Open(file);//Opening the file with SII include INI_ReadString(pass,"Password"); if(strlcmp(pass,inputtext,true) !=0) { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit"); return 1; } PInfo[playerid][Registered] = INI_ReadInt("Registered"); PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file. PInfo[playerid][Score] = INI_ReadInt("Score"); // Setting the score of player PInfo[playerid][Money] = INI_ReadInt("Money"); // Setting the money of player PInfo[playerid][Operator] = INI_ReadInt("Operator"); INI_Close();//"Closing the file", that means that we're not using it anymore :P SendClientMessage(playerid,-1,"You have been successfully logged in!"); PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1 SetPlayerScore(playerid, PInfo[playerid][Score]); GivePlayerMoney(playerid, PInfo[playerid][Money]); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit"); } return 1; } }
|
That didn't work at all it didn't even login anymore..
And we don't use a hash system.
Re: Login with any password bug -
mineralo - 22.12.2012
Quote:
Originally Posted by mineralo
if you use any hash system then don't forget to convert inputtext and after check it
|
read
Re: Login with any password bug -
mineralo - 22.12.2012
could you show codes where is show how saving password? like register dialog
Re: Login with any password bug -
Biess - 22.12.2012
Quote:
Originally Posted by mineralo
read
|
As i said, i don't use a hash system but my pass still doesn't work i typ in something random and it just logs in.
Re: Login with any password bug -
mineralo - 22.12.2012
if you not use any hash system then its should work.
well, I checked again your codes from dialog and I saw udb_hash.
do you use it when save password?
also, the password every time saving when log out? if yes then that is reason why you can't login in. remove that acc and try again
Re: Login with any password bug -
Vince - 22.12.2012
Quote:
Originally Posted by Biess
we don't use a hash system.
|
Please tell me the name of your server, so that I won't accidentally join it.
Re: Login with any password bug -
Biess - 22.12.2012
Quote:
Originally Posted by Vince
Please tell me the name of your server, so that I won't accidentally join it.
|
-.- it isn't even online yet. and may never will its just a fun project and why are you spamming here?
I need help no critism.