SA-MP Forums Archive
Whirlpool issue. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Whirlpool issue. (/showthread.php?tid=516350)



Whirlpool issue. - guitardude01 - 30.05.2014

We have a login system, however, if we compare our real password, to the inputted password, it removes the first character of the real password, thus, making the inputted password seem incorrect.

PHP код:
case DIALOG_LOGIN:
        {
            if ( !
response ) return Kick playerid );
            if( 
response )
            {
                new 
hpass[129];
                
WP_Hash(hpasssizeof(hpass), inputtext);
                if(!
strmatch(pVariables[playerid][pPassword], hpass))
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                else
                {
                    
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `users` WHERE `Username` = '%s' LIMIT 1"name1);
                    
mysql_tquery(mysqlquery"OnAccountLoad""i"playerid);
                }
                new 
string[256], string1[256];
                
format(stringsizeof(string), "Real pass: %s"pVariables[playerid][pPassword]);
                
SendClientMessageToAll(-1string);
                
format(string1sizeof(string1), "Input Pass: %s"hpass);
                
SendClientMessageToAll(-1string1);
                return 
1;
            } 



Heres a screenshot:




Re: Whirlpool issue. - Eth - 30.05.2014

show me the dialog register dude...


Re: Whirlpool issue. - guitardude01 - 30.05.2014

Here


PHP код:
case DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD""COL_WHITE"Registering...",""COL_RED"You have not entered a password.\n"COL_WHITE"Type a password below to register a new account.","Register","Quit");
                
WP_Hash(pVariables[playerid][pPassword], 129inputtext);
                
pVariables[playerid][pMoney] = 1500;
                
mysql_format(mysqlquerysizeof(query), "INSERT INTO `users` (`Username`, `Password`, `IP`, `Admin`, `Helper`, `VIP`, `Money`, `PosX`, `PosY`, `PosZ`, `Faction`, `FRank`, `Family`, `Medical`) VALUES ('%s', '%s', '%s', 0, 0, 0, 1500, '%f', '%f', '%f', '0', '0', '0', '0')"Name[playerid], pVariables[playerid][pPassword], IP[playerid], Spawn_XSpawn_YSpawn_Z);
                
mysql_tquery(mysqlquery"OnAccountRegister""i"playerid);
                
SendClientMessage(playeridCOL_BLUE"----Credits----");
                
SendClientMessage(playeridCOL_BLUE"Scripted by Connor and Tony ( All rights reserved © SF-RP )");
                
SendClientMessage(playeridCOL_BLUE"Mappings - Damon");
            } 



Re: Whirlpool issue. - guitardude01 - 31.05.2014

If thats the case, how come it wont let us login in?


Re: Whirlpool issue. - Copfan5 - 31.05.2014

Hmm, this is the first time I heard of it. Did you try re-downloading Whirlpool?


Re: Whirlpool issue. - guitardude01 - 01.06.2014

Anyone? Please I need this fixed.


Re: Whirlpool issue. - guitardude01 - 01.06.2014

Yes, it is threaded.


Re: Whirlpool issue. - rickisme - 01.06.2014

show we function OnAccountLoad and make sure length of column Password is 128


Re: Whirlpool issue. - Tagathron - 01.06.2014

Quote:
Originally Posted by rickisme
Посмотреть сообщение
show we function OnAccountLoad and make sure length of column Password is 128
No, the password field must be 129 characters in length. That's the length of the hashed passwords/strings.

But yeah, as you said, he needs to show the OnAccountLoad function.


Re: Whirlpool issue. - biker122 - 01.06.2014

Edited richisme's code a bit, not even 1 line, added a few numbers and a symbol.
pawn Код:
public OnPlayerConnect(playerid)
{
* * //... check roleplay name, banned, blah blah
* *
* * // Check if valid user
* * new name[MAX_PLAYER_NAME+1];
* * GetPlayerName(playerid, name, sizeof(name))
* * mysql_format(mysql, query, sizeof(query), "SELECT * FROM `users` WHERE `Username` = '%s' LIMIT 1", name);
* * new Cache:result = mysql_query(mysql, query);
* * if(cache_num_rows() > 0)
* * {
* * * * // Get password from database and set it to pVariables[playerid][pPassword]
* * * * cache_get_field_content(0,"Password",129,pVariables[playerid][pPassword]);
* * * * // Show real password from database
* * * * SendClientMessageToAll(-1, pVariables[playerid][pPassword]);
* * * * // Show login dialog
* * * * ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login","Type your password below to login.","Login","Quit");
* * }
* * else
* * {
* * * * // Show Register dialog
* * }
* * cache_delete(result);

* *
* * return 1;
}


case DIALOG_LOGIN:
{
* * if ( !response ) return Kick ( playerid );
* * if( response )
* * {
* * * * new hpass[129];
* * * * WP_Hash(hpass, sizeof(hpass), inputtext);
* * * * // Show Input Password
* * * * SendClientMessageToAll(-1, hpass);
* * * * if(!strmatch(pVariables[playerid][pPassword], hpass))
* * * * {
* * * * * * ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
* * * * }
* * * * else
* * * * {
* * * * * * mysql_format(mysql, query, sizeof(query), "SELECT * FROM `users` WHERE `Username` = '%s' LIMIT 1", name1);
* * * * * * mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
* * * * }
* * * * /*
* * * * new string[256], string1[256];
* * * * format(string, sizeof(string), "Real pass: %s", pVariables[playerid][pPassword]);
* * * * SendClientMessageToAll(-1, string);
* * * * format(string1, sizeof(string1), "Input Pass: %s", hpass);
* * * * SendClientMessageToAll(-1, string1);
* * * * */

* * * * return 1;
* * }
}
IGNORE ALL THE "*****", MY S3 FUCKED IT ALL.]