SA-MP Forums Archive
Mysql problem. - 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: Mysql problem. (/showthread.php?tid=455392)



Mysql problem. - Gangster-rocks - 01.08.2013

I've just started with mysql R7, Well, My registration system works fine, but my login system doesn't work, here is the codes
pawn Код:
//dialog
else if(dialogid == 1)
    {
        if(!response) return Kick(playerid);
        if(strlen(inputtext) <= 0) return SCM(playerid,-1,"{FFCC66}[SERVER]: {ffffff}You must input a password."),  ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{FFFFFF}Login",""COL_RED"INSERT A PASSWORD!","Login","QUIT");
        if(response)
        {
            new query[400];
            format(query,400,"SELECT username FROM stats WHERE username = '%s' AND password = '%s'",GN(playerid),escstring(inputtext));
            mysql_function_query(dbHandle,query,false,"CheckPassword","i",playerid);
        }
    }
//The function for the query.
function CheckPassword(playerid)
{
    new rows,fields;
    cache_get_data(rows,fields,dbHandle);
    if(!rows)
    {
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{ffffff}Login","Wrong password","Login","Close");
    }
    else if(rows == 1)
    {
        LoadAccount(playerid);
    }
}
login system allows me to login with any password


Re: Mysql problem. - -Prodigy- - 01.08.2013

Try
pawn Код:
mysql_function_query(dbHandle,query,true,"CheckPassword","i",playerid);



Re: Mysql problem. - Gangster-rocks - 01.08.2013

Thanks for helping, but i've already solved it.


Re: Mysql problem. - Scenario - 01.08.2013

Hash your passwords!!!


Re: Mysql problem. - Gangster-rocks - 01.08.2013

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Hash your passwords!!!
Am using a ucp for my server, i can't hash password tho.


Re: Mysql problem. - Scenario - 01.08.2013

That doesn't mean anything! Use Whirlpool hashing!