MYSQL - login with threded query - 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 - login with threded query (
/showthread.php?tid=614028)
MYSQL - login with threded query -
Ax3l123 - 03.08.2016
I am building a new gamemode and i'm working at the login system .
The problem is that every time I login the server the server shows me the register dialog even if I have an account already .
I'm using the lastest MySQL- plugin (r39-5).
PHP код:
[19:29:40] [DEBUG] mysql_connect - host: "127.0.0.1", user: "root", database: "newgm", password: "****", port: 3306, autoreconnect: true, pool_size: 2
[19:29:40] [DEBUG] CMySQLHandle::Create - creating new connection..
[19:29:40] [WARNING] CMySQLHandle::Create - connection already exists
[19:29:40] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[19:29:40] [DEBUG] CMySQLConnection::Connect - connection was successful
[19:29:40] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[19:29:40] [DEBUG] mysql_errno - connection: 1
[19:29:40] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[19:29:40] [DEBUG] CMySQLConnection::Connect - connection was successful
[19:29:40] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[19:29:40] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[19:29:40] [DEBUG] CMySQLConnection::Connect - connection was successful
[19:29:40] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[19:29:40] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[19:29:40] [DEBUG] CMySQLConnection::Connect - connection was successful
[19:29:40] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[19:29:40] [DEBUG] mysql_tquery - connection: 1, query: "SELECT `Password`, `ID` FROM `useri` WHERE `nume` = 'e' LIMIT 1", callback: "AccCheck", format: "i"
[19:29:40] [DEBUG] CMySQLQuery::Execute[AccCheck] - starting query execution
[19:29:40] [DEBUG] CMySQLQuery::Execute[AccCheck] - query was successfully executed within 0.462 milliseconds
[19:29:40] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[19:29:40] [DEBUG] Calling callback "AccCheck"..
[19:29:40] [DEBUG] cache_get_data - connection: 1
[19:29:40] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
MySQL- log
PHP код:
forward AccCheck(playerid);
public AccCheck(playerid)
{
new fields,rows;
cache_get_data(rows , fields, sql);
if(rows)
{
cache_get_field_content(0, "Password", PlayerInfo[playerid][pPass], sql, 129);
PlayerInfo[playerid][pID] = cache_get_field_content_int(0, "ID");
new loginstring[128];
format(loginstring,sizeof(loginstring),"Bine ai revenit , Introdu parola pentru a juca. ");
ShowPlayerDialog(playerid,LoginDialog,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Quit");
}
else
{
ShowPlayerDialog(playerid,RegisterDialog,DIALOG_STYLE_PASSWORD,"Register","Bine ai venit pe serverul nostru ! Introdu o parola pentru a te inregistra:","Register","Quit");
}
return 1;
}
PHP код:
public OnPlayerConnect(playerid)
{
new query[128];
format(query,sizeof(query),"SELECT `Password`, `ID` FROM `useri` WHERE `nume` = '%e' LIMIT 1",GetName(playerid));
mysql_tquery(sql,query,"AccCheck","i",playerid);
gPlayerLogged[playerid] = 0;
return 1;
}
Re: MYSQL - login with threded query -
AndySedeyn - 03.08.2016
Only mysql_format supports the %e specifier.
Re: MYSQL - login with threded query -
Ax3l123 - 03.08.2016
thank you , fixed !