Login bug
#1

Hi

Everytime I close the server and load it again, and then attempt to log back into the account I just made - it does not let me pass the dialog box to log in. I am not sure whats happening. It makes it so that I have to keep deleting accounts from the database instead of keeping them

Here is my playercheck code:

PHP Code:
forward OnPlayerDataCheck(playeridcorrupt_check);
public 
OnPlayerDataCheck(playeridcorrupt_check)
{
    if (
corrupt_check != Corrupt_Check[playerid]) return Kick(playerid);
    
    new 
string[150], rows;
    
cache_get_row_count(rows);
    if(
rows)
    {
        
cache_get_value(0"playerPass"playerInfo[playerid][playerPass],65);
        
playerInfo[playerid][Player_Cache] = cache_save();
            
format(stringsizeof(string), "{FFFFFF}Welcome back, %s.\n{0099FF}You're already registered. Log in to the server below."playerInfo[playerid][playerName]);
            
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Login to the server"string"Login""Leave");
    }
    else
    {
        
format(stringsizeof(string), "{FFFFFF}Welcome %s. to County-Side Roleplay\n\n{0099FF}You're not registered. Input a password to begin."playerInfo[playerid][playerName]);
            
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD"Registration to the server"string"Register""Leave");
            }
    return 
1;

Here is my dialog_login (both dialogs

PHP Code:
        case DIALOG_LOGIN:
        {
            new 
Salted_Key[65];
            if(!
response) return Kick(playerid);
            
SHA256_PassHash(inputtextplayerInfo[playerid][Salt], Salted_Key65);
            new 
string[128];
            
format(stringsizeof(string), "{FFFFFF}Welcome back, %s.\n{0099FF}You're already registered. Log in to the server below."playerInfo[playerid][playerName]);
            
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Login to the server"string"Login""Leave");
            if(
strcmp(Salted_KeyplayerInfo[playerid][playerPass]) == 0)
            {
                
cache_set_active(playerInfo[playerid][Player_Cache]);
                
cache_delete(playerInfo[playerid][Player_Cache]);
                
playerInfo[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
                
playerInfo[playerid][LoggedIn] = true;
                   new 
DB_Query[225];
                print(
DB_Query);
                
ShowPlayerDialog(playeridDIALOG_UNUSEDDIALOG_STYLE_MSGBOX"Login""You have been successfully logged in.""Okay""");
                   
mysql_format(DatabaseDB_Querysizeof(DB_Query), "SELECT * FROM `accounts` WHERE `playerName` = '%s' LIMIT 1"playerInfo[playerid][playerName]);
                
mysql_tquery(DatabaseDB_Query"LoadPlayerStats""i"playerid);
                
TextDrawHideForPlayer(playeridcountyside);
                
TextDrawHideForPlayer(playeridroleplay);
                
TextDrawHideForPlayer(playeridBOX);
                
TextDrawHideForPlayer(playeridoutline1);
                
TextDrawHideForPlayer(playeridoutline2);
                
//SendClientMessage(playerid, 0x00FF00FF, "SERVER: {FFFFFF} You've just logged into this account.");
            
}
            
        }
        case 
DIALOG_REGISTER:
        {
            new 
string[128];
            if(!
response) return Kick(playerid);
            
format(stringsizeof(string), "{FFFFFF}Welcome %s. to County-Side Roleplay\n\n{0099FF}You're not registered. Input a password to begin."playerInfo[playerid][playerName]);
            
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD"Registration to the server"string"Register""Leave");
            
            if(
strlen(inputtext) <= || strlen(inputtext) > 60)
                  return 
SendClientMessage(playerid0x969696FF"Invalid password length, should be 5 - 60.");
                  
            for (new 
016i++) playerInfo[playerid][Salt][i] = random(94) + 33;
            
SHA256_PassHash(inputtextplayerInfo[playerid][Salt], playerInfo[playerid][playerPass], 65);
            new 
DB_Query[225];
            
mysql_format(DatabaseDB_Querysizeof DB_Query"INSERT INTO `accounts` (`playerName`, `playerPass`, `salt`) VALUES ('%e', '%s', '%e')"playerInfo[playerid][playerName], playerInfo[playerid][playerPass], playerInfo[playerid][Salt]);
              
mysql_tquery(DatabaseDB_Query"OnPlayerRegister""d"playerid);
            
SetPlayerScore(playerid1);
            
TextDrawHideForPlayer(playeridcountyside);
            
TextDrawHideForPlayer(playeridroleplay);
            
TextDrawHideForPlayer(playeridBOX);
            
TextDrawHideForPlayer(playeridoutline1);
            
TextDrawHideForPlayer(playeridoutline2);
        }
    } 
Reply
#2

Bump as I have this problem
Reply
#3

Seems like you're not loading the salt...
PHP Code:
forward OnPlayerDataCheck(playeridcorrupt_check); 
public 
OnPlayerDataCheck(playeridcorrupt_check

    if (
corrupt_check != Corrupt_Check[playerid]) return Kick(playerid); 
     
    new 
string[150], rows
    
cache_get_row_count(rows); 
    if(
rows
    { 
        
cache_get_value(0"playerPass"playerInfo[playerid][playerPass],65); 
        
cache_get_value(0"salt"playerInfo[playerid][Salt],17); 

        
playerInfo[playerid][Player_Cache] = cache_save(); 

            
format(stringsizeof(string), "{FFFFFF}Welcome back, %s.\n{0099FF}You're already registered. Log in to the server below."playerInfo[playerid][playerName]); 
            
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Login to the server"string"Login""Leave"); 
    } 
    else 
    { 
        
format(stringsizeof(string), "{FFFFFF}Welcome %s. to County-Side Roleplay\n\n{0099FF}You're not registered. Input a password to begin."playerInfo[playerid][playerName]); 
            
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD"Registration to the server"string"Register""Leave"); 
            } 
    return 
1

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)