MYSQL Not showing Login/Register Dialog
#1

As the topic name said's it...


Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case LoginDialog:
        {
            if(!response) Kick(playerid);

            new
                hashpass[129],
                query[100],
                playername[MAX_PLAYER_NAME];

            GetPlayerName(playerid, playername, sizeof(playername));
            WP_Hash(hashpass, sizeof(hashpass), inputtext);
            if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
            {
                mysql_format(Database, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1", playername);
                mysql_tquery(Database, query, "OnAccountLoad", "i", playerid);
            }
            else
            {
                SendClientMessage(playerid, -1, "You have specified an incorrect password!");
                ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_INPUT, "Login", "Welcome player!\nYour account has been found in our database. Please fill in your password:", "Login", "Quit");
            }
        }
}
Код:
forward OnAccountCheck(playerid);
public OnAccountCheck(playerid)
{
    new rows;
    cache_get_row_count(rows);

    if(rows)
    {
        cache_get_value_name(0, "Password", PlayerInfo[playerid][Password]);
        cache_get_value_name_int(0, "ID", PlayerInfo[playerid][ID]);
        ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_INPUT, "Login", "Welcome player!\nYour account has been found in our database. Please fill in your password:", "Login", "Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_INPUT, "Register", "Welcome player!\nYour account has not been registered yet. Please fill in your desired password:", "Register", "Quit");
    }
    return true;
}
Код:
public OnPlayerConnect(playerid)
{
  new pname[MAX_PLAYER_NAME], string[250 + MAX_PLAYER_NAME], query[128];

    mysql_format(Database, query, sizeof(query), "SELECT `Password`, `ID` FROM `accounts` WHERE `Name` = '%e' LIMIT 1", pname);
    mysql_tquery(Database, query, "OnAccountCheck", "i", playerid);
    
}
log warning


Код:
[18:08:42] [INFO] changed log level from 'warning, error' to 'debug, info, warning, error'
[18:08:42] [DEBUG] mysql_connect("127.0.0.1", "root", "*****", "server", 0)
[18:08:42] [DEBUG] CHandleManager::Create(this=0x7e32c0, host='127.0.0.1', user='root', pass='****', db='server', options=0x7d3698)
[18:08:42] [INFO] Creating new connection handle...
[18:08:42] [WARNING] mysql_connect: no password specified
[18:08:42] [DEBUG] CConnection::CConnection(this=0x7e5ab0, host='127.0.0.1', user='root', passw='****', db='server', options=0x7d3698)
[18:08:42] [DEBUG] CConnection::CConnection - new connection = 0x7b11f0
[18:08:42] [DEBUG] CConnection::CConnection(this=0x3b30020, host='127.0.0.1', user='root', passw='****', db='server', options=0x7d3698)
[18:08:42] [DEBUG] CConnection::CConnection - new connection = 0x7f8d30
[18:08:42] [DEBUG] CThreadedConnection::WorkerFunc(this=0x3b30020, connection=0x3b30020)
[18:08:42] [DEBUG] CThreadedConnection::CThreadedConnection(this=0x3b30020, connection=0x3b30020)
[18:08:42] [DEBUG] CConnectionPool::CConnectionPool(size=2, this=0x7e5af0)
[18:08:42] [DEBUG] CConnection::CConnection(this=0x3d04020, host='127.0.0.1', user='root', passw='****', db='server', options=0x7d3698)
[18:08:42] [DEBUG] CConnection::CConnection - new connection = 0x803218
[18:08:42] [DEBUG] CThreadedConnection::WorkerFunc(this=0x3d04020, connection=0x3d04020)
[18:08:42] [DEBUG] CThreadedConnection::CThreadedConnection(this=0x3d04020, connection=0x3d04020)
[18:08:42] [DEBUG] CConnection::CConnection(this=0x3ed7020, host='127.0.0.1', user='root', passw='****', db='server', options=0x7d3698)
[18:08:42] [DEBUG] CConnection::CConnection - new connection = 0x80da60
[18:08:42] [DEBUG] CThreadedConnection::CThreadedConnection(this=0x3ed7020, connection=0x3ed7020)
[18:08:42] [DEBUG] CThreadedConnection::WorkerFunc(this=0x3ed7020, connection=0x3ed7020)
[18:08:42] [INFO] Connection handle with id '1' successfully created.
[18:08:42] [DEBUG] CHandleManager::Create - new handle = 0x7d7e50
[18:08:42] [DEBUG] mysql_connect: return value: '1'
[18:08:42] [DEBUG] mysql_errno(1)
[18:08:42] [DEBUG] CHandle::GetErrorId(this=0x7d7e50)
[18:08:42] [DEBUG] CConnection::GetError(this=0x7e5ab0, connection=0x7b11f0)
[18:08:42] [DEBUG] CHandle::GetErrorId - return value: true, error id: '0', error msg: ''
[18:08:42] [DEBUG] mysql_errno: return value: '0'
[18:09:04] [DEBUG] mysql_format(0, 0x039EC9C4, 128, "SELECT `Password`, `ID` FROM `accounts` WHERE `Name` = '%e' LIMIT 1")
[18:09:04] [ERROR] mysql_format: invalid connection handle '0'
[18:09:04] [DEBUG] mysql_tquery(0, "", "OnAccountCheck", "i")
[18:09:04] [ERROR] mysql_tquery: invalid connection handle '0'
[18:09:04] [DEBUG] mysql_tquery: return value: '0'
Reply


Messages In This Thread
MYSQL Not showing Login/Register Dialog - by DerickClark - 04.06.2018, 23:13
Re: MYSQL Not showing Login/Register Dialog - by Criniti - 05.06.2018, 02:41
Re: MYSQL Not showing Login/Register Dialog - by DerickClark - 05.06.2018, 03:43
Re: MYSQL Not showing Login/Register Dialog - by GTLS - 05.06.2018, 06:36
Re: MYSQL Not showing Login/Register Dialog - by DerickClark - 05.06.2018, 06:43
Re: MYSQL Not showing Login/Register Dialog - by GTLS - 05.06.2018, 07:11
Re: MYSQL Not showing Login/Register Dialog - by DerickClark - 05.06.2018, 07:21
Re: MYSQL Not showing Login/Register Dialog - by GTLS - 05.06.2018, 08:29
Re: MYSQL Not showing Login/Register Dialog - by DerickClark - 05.06.2018, 16:11
Re: MYSQL Not showing Login/Register Dialog - by GTLS - 05.06.2018, 16:38

Forum Jump:


Users browsing this thread: 1 Guest(s)