Incorrect Password
#1

A bug occurred within my script, and I'm very unsure as to why it's happening. It basically doesn't allow anyone to login, even though the password is correct. I'm unsure why it begins happening.

PHP код:
    else if(dialogid == DIALOG_LOGIN)
    {
        if(!
response) return Kick(playerid);
        else
          {
               new 
hpass[129];
             
WP_Hash(hpass129inputtext);
              if(!
strcmp(hpassPlayerInfo[playerid][pPass]))
               {
                 
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `users` WHERE `Username` = '%e' LIMIT 1"Name[playerid]);
                  
mysql_tquery(mysqlquery"OnAccountLoad""i"playerid);
                
TextDrawHideForPlayer(playerid,Login1[playerid]);
                
TextDrawHideForPlayer(playerid,Login2[playerid]);
                
TextDrawHideForPlayer(playerid,Login3[playerid]);
                
TextDrawHideForPlayer(playerid,Login4[playerid]);
                
TextDrawHideForPlayer(playerid,Login5[playerid]);
                
TextDrawHideForPlayer(playerid,Login6[playerid]);
                
TextDrawHideForPlayer(playerid,Login7[playerid]);
                
TogglePlayerSpectating(playeridfalse);
                
PlayTimer[playerid] = SetTimerEx("PlayingTime"600001"i"playerid);
                
StopAudioStreamForPlayer(playerid);
            }
            else
               {
                  
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_MSGBOX,""COL_RED"KICKED",""COL_RED"You have been kicked for entering an incorrect password.","QUIT","");
                
KickPlayer(playerid);
            }
               return 
1;
           }
       } 
Reply
#2

I'm afraid this part you posted looks entirely correct. Is it possible that your inputtext callback argument gets modified earlier in your callback for some reason?
Reply
#3

You might have forget to load player's password hash from the database before showing the login dialog.
Reply
#4

Quote:
Originally Posted by oMa37
Посмотреть сообщение
You might have forget to load player's password hash from the database before showing the login dialog.
Huh? That would let the player log in...

Strcmp returns 0 if either string is empty.

-----

The user's hash is probably produced with "raw password + salt". Doesn't look like you created the script.
Reply
#5

Quote:
Originally Posted by Paulice
Посмотреть сообщение
The user's hash is probably produced with "raw password + salt". Doesn't look like you created the script.
Could be correct, we can't really know since we don't have the hash function in sight. It would be a good idea anyway if using a weak hashing algorithm.
But really, most people posting here have indeed not created the script, I'm not sure that prevents us from helping them!
Reply
#6

Show us your server log. Maybe the Plugin isn't loading?

On the other hand, you should use https://sampwiki.blast.hk/wiki/SHA256_PassHash instead.
Here is a Tutorial: https://sampforum.blast.hk/showthread.php?tid=581336 As you don't have to load an extra Plugin.
Reply
#7

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
Show us your server log. Maybe the Plugin isn't loading?

On the other hand, you should use https://sampwiki.blast.hk/wiki/SHA256_PassHash instead.
Here is a Tutorial: https://sampforum.blast.hk/showthread.php?tid=581336 As you don't have to load an extra Plugin.
What kind of solution is that? Gosh...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)