MySQL storing player password
#1

Heya there, started learning MySQL and im trying to transfer my mode from dini to MySQL

The cache_get_field_content is used only on forwarded callbacks as much as I know

OnDialogResponse
PHP код:
else if(dialogid == 2// Login
    
{
        if(
response)
        {
            new 
password[256], IP[16], password2[256], query[100];
            
WP_Hash(password2sizeof(password2), inputtext);
            [
COLOR="Red"]password cache_get_field_content([/COLOR]
            if(
strlen(inputtext) <= 0)
            {
                 
SendClientMessage(playeridCOLOR_LIGHTRED"SERVER: {FFFFFF}You must enter a password to procceed.");
                 
ShowDialog(playerid2);
                 return 
1;
            }
            if(
strlen(inputtext) >= 256)
            {
                 
SendClientMessage(playeridCOLOR_LIGHTRED"SERVER: {FFFFFF}Invalid Password.");
                 
ShowDialog(playerid2);
                 return 
1;
            }
            if(!
strcmp(password2passwordfalse))
            {
                
SendClientMessage(playeridCOLOR_LIME"");
                
SendClientMessage(playeridCOLOR_LIME"");
                
SendClientMessage(playeridCOLOR_RED"SERVER: {FFFFFF}Login Successful");
                
format(PlayerInfo[playerid][pIP], 16"%s"dini_Get(file"IP"));
                
GetPlayerIp(playeridIPsizeof(IP));
                
dini_Set(file"IP"IP);
                
PlayerInfo[playerid][pGender] = dini_Int(file"Gender");
                
PlayerInfo[playerid][pAge] = dini_Int(file"Age");
                if(!
PlayerInfo[playerid][pGender] || !PlayerInfo[playerid][pAge])
                {
                    
ShowDialog(playerid3);
                }
                else
                {
                    
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `players` WHERE `Username` = '%e' LIMIT 1"RPNU(playerid));
                    
mysql_tquery(mysqlquery"OldToys""i"playerid);
                    
mysql_tquery(mysqlquery"LoadToys""i"playerid);
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_LIGHTRED"SERVER: {FFFFFF}Invalid password.");
                
ShowDialog(playerid2);
                return 
1;
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_LIGHTRED"SERVER: {FFFFFF}You have chosen to quit the server.");
            
Kick(playerid);
        }
    } 
In the red line, how can I store the player's password ? It's stored under the column Password, how can I get his row ?

NOTE: I have added an ID to the playerinfo enum (auto increase)
Can I use it to get the row ?
Reply


Messages In This Thread
MySQL storing player password - by NeXoR - 25.04.2016, 20:04
Re: MySQL storing player password - by J0sh... - 25.04.2016, 20:10
Re: MySQL storing player password - by NeXoR - 25.04.2016, 20:33
Re: MySQL storing player password - by Gammix - 25.04.2016, 20:40
Re: MySQL storing player password - by NeXoR - 25.04.2016, 21:35

Forum Jump:


Users browsing this thread: 1 Guest(s)