Mysql problem
#5

@will yes, i have the compatible version ( mysql R39-2)

@Chlorine yes check

PHP код:
public OnAccountCheck(playerid)
{
    new 
rowsfieldsstring[240], plrIP[16];
    
GetPlayerIp(playeridplrIPsizeof(plrIP));
    
cache_get_data(rowsfieldsg_iHandle);
    if(
rows//if there is row
    
{
        
cache_get_field_content(0"Password"APlayerData[playerid][PlayerPassword], g_iHandle129);
        
APlayerData[playerid][CompteID] = cache_get_field_content_int(0"ID");
        
printf("MDP CHARGE : %s"APlayerData[playerid][PlayerPassword]);
        
format(string2000TXT_DialogLoginMsgGetPlayerNameEx(playerid), plrIP);
        
ShowPlayerDialog(playeridDialogLoginDIALOG_STYLE_PASSWORDTXT_DialogLoginTitlestringTXT_DialogLoginButton1TXT_DialogButtonCancel);
    }
    else
    {
        new 
strStartRules[2000];
                
// RULES TEXT
        
ShowPlayerDialog(playeridDialogStartRulesDIALOG_STYLE_MSGBOX"Rиglement du serveur"strStartRules"Refuser""Accepter");
    }
    
printf("ETAT DU SERVEUR : CHECK D'UN COMPTE");
    return 
1;

Query :
PHP код:
    mysql_format(g_iHandlequerysizeof(query),"SELECT `Password`, `ID` FROM `users` WHERE `PlayerName` = '%e' LIMIT 1"GetPlayerNameEx(playerid));
    
mysql_tquery(g_iHandlequery"OnAccountCheck""i"playerid); 
Dialog response :

PHP код:
// Process the login-dialog
Dialog_Login(playeridresponseinputtext[])
{
    switch (
response// Check which button was clicked
    
{
        case 
1// Player clicked "Login"
        
{
            
// Check if the player entered a password
            
if (strlen(inputtext) > 0)
            {
                new 
query[100]; // for formatting our query.
                
if(!strcmp(inputtextAPlayerData[playerid][PlayerPassword])) 
                { 
                    
mysql_format(g_iHandlequerysizeof(query), "SELECT * FROM `users` WHERE `ID` = '%d' LIMIT 1"APlayerData[playerid][CompteID]);
                    
mysql_tquery(g_iHandlequery"PlayerFile_Load""i"playerid);
                    
                    
mysql_format(g_iHandlequerysizeof(query), "SELECT * FROM `bank` WHERE `ID` = '%d' LIMIT 1"APlayerData[playerid][CompteID]);
                    
mysql_tquery(g_iHandlequery"BankFile_Load""i"playerid);
                    
format(querysizeof(query), "UPDATE `users` SET `LoggedIN` = '1' WHERE `ID` = %d"APlayerData[playerid][CompteID]);
                    
mysql_format(g_iHandlequerysizeof(query), "%s"query);
                    
mysql_tquery(g_iHandlequery); 
    
                    
APlayerData[playerid][LoggedIn] = true;
                }
                else
                {
                    
ShowPlayerDialog(playeridDialogLoginDIALOG_STYLE_PASSWORDTXT_DialogLoginTitleTXT_LoginEnterPasswordWrongTXT_DialogLoginButton1TXT_DialogButtonCancel);
                }
                return 
1;
            }
            else
            {
                
SendClientMessage(playerid0xFFFFFFFFTXT_WrongPassword);
                
KickEx(playerid);
            }
        }
        case 
0// Player clicked "Cancel"
        
{
            
// Show a message that the player must be logged in to play on this server
            
SendClientMessage(playerid0xFFFFFFFFTXT_PlayerMustLogin);
            
// Kick the player
            
KickEx(playerid);
        }
    }
    return 
1;

Reply


Messages In This Thread
Mysql problem - by AlexBlack - 03.04.2015, 13:36
Re : Mysql problem - by AlexBlack - 03.04.2015, 14:21
Re: Mysql problem - by willsuckformoney - 03.04.2015, 14:38
Re: Mysql problem - by Chlorine - 03.04.2015, 14:53
Re : Mysql problem - by AlexBlack - 03.04.2015, 15:03
Re: Mysql problem - by Chlorine - 03.04.2015, 15:05
Re : Mysql problem - by AlexBlack - 03.04.2015, 15:14
Re: Mysql problem - by Chlorine - 03.04.2015, 15:32
Re : Mysql problem - by AlexBlack - 03.04.2015, 15:45
Re: Mysql problem - by Chlorine - 03.04.2015, 15:48

Forum Jump:


Users browsing this thread: 2 Guest(s)