• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

TDP - PHP Function to give Alz

Moderator
Staff member
Moderator
Joined
Feb 22, 2008
Messages
2,404
Reaction score
724
This is the main function:

Code:
class SQL
{
    function __construct()
    {
// SQL CONFIGURATIONS GOES HERE
        $this->host = "CASA\SQLEXPRESS";
        $this->senha = "123456"; 
        $this->user = "sa"; 
    }
}
class cabal extends SQL
{
    function conectar_sql()
    {
        $connection_string = 'DRIVER={SQL Server};SERVER='.$this->host.';DATABASE=ACCOUNT';
        $connection = odbc_connect( $connection_string, $this->user, $this->senha );
        if(!$connection)
        {
            return trigger_error("Falha ao conectar com SQL! Verifique os dados e tente novamente.",E_USER_ERROR);
        }else{
            return $connection;
        }
    }

    function GiveAlz($quantidade,$char)
    {
        $connection = $this->conectar_sql();
        $query = sprintf("UPDATE [gamedb].[dbo].[cabal_character_table] SET [Alz] = '%d' WHERE [Name] = '%s' ",$quantidade,$char);
        $go = odbc_exec($connection,$query);
        odbc_free_result($go);
        if($go){return true;}else{ return false;}
        
    }
}

Ok, this might be a 'lil bit confusing to you atm, but its just how PHP manage classes.
Now we do:

Code:
$cabal = new cabal; // instanciating the class

$cabal->GiveAlz(1000,'MyChar');
This would give 1000 to MyChar.


:laugh: I think chumpy might lost his place to me muahahaha, nahh, I'm just kiding. He is better than me. See ya.
 
Back
Top