Why didn't work ?
#1

When I try to login, the server tells me the password is wrong. What's wrong ?

PHP код:
if(dialogid == REGISTER)
    {
       if(!
strlen(inputtext)) return ShowPlayerDialog(playeridREGISTERDIALOG_STYLE_PASSWORD"{FFFF00}Inregistrare""{FF0000}Trebuie sa va inregistrati""Register""Inchide");
       if(!
response) return Kick(playerid);
       if(
response)
       {
          new 
INI:File INI_Open(User(playerid));
          
INI_WriteInt(File"Password"udb_hash(inputtext));
          
INI_Close(File);
          
PlayerPlaySound(playerid10570.00.00.0);
          
SendClientMessage(playerid0x00FF00FF"Te-ai inregistrat cu succes !");
          new 
String[256], Name[MAX_PLAYER_NAME], ddmmyyhm;
          
GetPlayerName(playeridNamesizeof(Name));
          
getdate(yymmdd);
          
gettime(hm);
          
format(Stringsizeof(String), "{FFFFFF}Nume: {FFFF00}%s\n{FFFFFF}Data: {FFFF00}%02d/%02d/%02d\n{FFFFFF}Ora: {00FF00}%02d:%02d\n{FFFFFF}Parola: {FFFF00}%s\n{00773C}Apasa butonul 'F8' pentru a face o captura a ecranului."Nameddmmyyhminputtext);
          
ShowPlayerDialog(playerid11DIALOG_STYLE_MSGBOX"{00FF00}Informatii inregistrare."String"Ok""");
          
DestroyRegistrationMenu(playerid);
       }
    }
     if(
dialogid == LOGIN)
    {
       if(!
response) return Kick(playerid);
       if(!
strlen(inputtext)) return ShowPlayerDialog(playeridLOGINDIALOG_STYLE_PASSWORD"{FF0000}Conectare""{FF0000}Trebuie sa te conectezi.""Connect""Iesire");
       if(
response)
       {
          
INI_ParseFile(User(playerid), "PlayerData_Data", .bExtra true, .extra playerid);
          if(
udb_hash(inputtext) == pInfo[playerid][Pass])
          {
             
SpawnPlayer(playerid);
             
SetPlayerPos(playeridpInfo[playerid][x], pInfo[playerid][y], pInfo[playerid][z]);
             
SetPlayerFacingAngle(playeridpInfo[playerid][a]);
             
GivePlayerMoney(playeridpInfo[playerid][Cash]);
             
SetPlayerScore(playeridpInfo[playerid][Score]);
             
pInfo[playerid][Kills] = pInfo[playerid][Kills];
             
pInfo[playerid][Deaths] = pInfo[playerid][Deaths];
             
PlayerPlaySound(playerid10570.00.00.0);
             
SendClientMessage(playerid0x00FF00FF"Ai fost conectat pe server cu succes.");
             
DestroyRegistrationMenu(playerid);
          }
          else
          {
             if(
Attempts[playerid] <= 2)
             {
                
PlayerPlaySound(playerid10580.00.00.0);
                
Attempts[playerid] ++;
                new 
String[128];
                
format(Stringsizeof(String), "{FF0000}Parola gresita {FFFF00}%d/3 {FFFFFF}incercari."Attempts[playerid]);
                
ShowPlayerDialog(playeridLOGINDIALOG_STYLE_PASSWORD"{FF0000}Conectare"String"Connect""Iesire");
             }
             if(
Attempts[playerid] == 3)
             {
                
PlayerPlaySound(playerid10580.00.00.0);
                
ShowPlayerDialog(playerid12DIALOG_STYLE_MSGBOX"{FF0000}Conectare epuizata""{FF0000}Ai fost dat afara pentru ca ai gresit parola de conectare de 3 ori.""Am inteles.""");
                
SetTimerEx("KickForBadLogin"500false"i"playerid);
                
DestroyRegistrationMenu(playerid);
             }
          }
       }
    } 
and

PHP код:
public PlayerData_Data(playeridname[], value[])
{
    
INI_Int("Password"pInfo[playerid][Pass]);
    
INI_Float("X"pInfo[playerid][x]);
    
INI_Float("Y"pInfo[playerid][y]);
    
INI_Float("Z"pInfo[playerid][z]);
    
INI_Float("A"pInfo[playerid][a]);
    
INI_Int("Cash"pInfo[playerid][Cash]);
    
INI_Int("Score"pInfo[playerid][Score]);
    
INI_Int("Kills"pInfo[playerid][Kills]);
    
INI_Int("Deaths"pInfo[playerid][Deaths]);
    return 
1;

Reply
#2

Before trying to fix that problem, I would recommend to change your hashing method to Whirlpool. udb_hash can be cracked easily, use Whirlpool WITH salts in order to make the data (actually, OUR data) safe.

After you switch to a recommended hash method, I would suggest you to start debugging the script to find where the authentication problem is.
Reply
#3

Thank's for the info but for the moment is perfectly this method. I'm not pro in pawno but i want to learn. Learn with this community and wiki.
Reply
#4

UP !
Reply
#5

You can use this to simplify registration: https://sampforum.blast.hk/showthread.php?tid=616023

But to the fix the problem, replace this:
Код:
INI_ParseFile(User(playerid), "PlayerData_Data", .bExtra = true, .extra = playerid);
With this:
Код:
INI_ParseFile(User(playerid), "PlayerData_%s", .bExtra = true, .extra = playerid);
And make sure to write everything under the [Data] tag.
Or else, you can remove all of the tags, and load the whole file under one callback.
Reply
#6

Doesn't work.
Reply
#7

up !
Reply
#8

UP ! !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)