Login System error
#1

Hello, i'm having an error with my login/register system.

It's has something to do with the password, because even if i type the wrong password it still logs me in...

Here is the codes that have to do with login:

PHP код:
forward OnAccountCheck(playerid);
public 
OnAccountCheck(playerid)
{
    new 
rowsfields;
    
cache_get_row_count(rows);
    
cache_get_field_count(fields);
    if(
rows)
    {
        
cache_get_value_name(0"PASS"PlayerInfo[playerid][Password]);
        
cache_get_value_name_int(0"ID"PlayerInfo[playerid][ID]);
        
printf("%s"PlayerInfo[playerid][Password]);
        
Dialog_Show(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Login""Welcome to Roleplay. Type your password below to login to your account.""Login""Exit");
    }
    else
    {
        
Dialog_Show(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD"Register""Welcome to Roleplay. In order to play you will need to register an account. Type a decent password below to continue.""Register""Exit");
    }
    return 
1;

PHP код:
Dialog:DIALOG_LOGIN(playeridresponselistiteminputtext[])
{
    if(!
responseKick(playerid);
    new 
hpass[129];
    new 
query[100];
    
WP_Hash(hpass129inputtext);
    if(!
strcmp(hpassPlayerInfo[playerid][Password]))
    {
        
mysql_format(Databasequerysizeof(query), "SELECT * FROM `players` WHERE `Username` = '%e' LIMIT 1"Name[playerid]);
        
mysql_tquery(Databasequery"OnAccountLoad""i"playerid);
    }
    else
    {
        
Dialog_Show(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"Login""{FF0000}Wrong Password!\n{FFFFFF}Input your correct password to continue!""Login""Exit");
    }
    return 
1;

Reply
#2

Fixed, dammit im so dumb.

Had to change
PHP код:
cache_get_value_name(0"Password"PlayerInfo[playerid][Password]); 
To:

PHP код:
cache_get_value_name(0"Password"PlayerInfo[playerid][Password], 129); 
Reply
#3

Please Salt the passwords
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)