[Help]mssql connection to odbc

Results 1 to 7 of 7
  1. #1
    Mocro.net Mocro is offline
    MemberRank
    Feb 2008 Join Date
    Amsterdam.Location
    891Posts

    [Help]mssql connection to odbc

    is it possible to change the panels connection to odbc ?

    From Panel Connection
    Code:
    $conn = mssql_connect($mssql_host, $mssql_user, $mssql_pass); 
    mssql_select_db($mssql_database);
    To This
    Code:
    $connect = odbc_connect("Driver={SQL Server};Server={$host}; Database={$dbname}", $user, $pass) or die("Can't connect the MSSQL server.");
    i hope some1 can help me


  2. #2
    Account Upgraded | Title Enabled! katsumi is offline
    MemberRank
    Oct 2008 Join Date
    Earth ??Location
    592Posts

    Re: [Help]mssql connection to odbc

    odbc_connect(dsn, user, pass);

  3. #3
    Mocro.net Mocro is offline
    MemberRank
    Feb 2008 Join Date
    Amsterdam.Location
    891Posts

    Re: [Help]mssql connection to odbc

    Cant make this to work is it possible to make whole config.php to odbc connection so no mssql connection:

    This is from Emisand's Gunz Admin Panel v3 i want it to connect with odbc
    Code:
    <?php
        if( !ereg("index.php", $_SERVER['PHP_SELF']) )
        {
            header("Location: index.php");
            die();
        }
    
       ///////////////////////////////////
      // Emisand's Gunz Admin Panel /////
     /// -- Configuration File  -- /////
    ///////////////////////////////////
    
    //MSSQL Server configuration
    
    $_MSSQL[Host]   = "COMPUTER\SQLEXPRESS";    // MSSQL Server HOST, it can be an IP Address or a computer name
    $_MSSQL[User]   = "sa";                     // MSSQL User
    $_MSSQL[Pass]   = "";                       // MSSQL Password
    $_MSSQL[DBNa]   = "GunzDB";                 // Gunz Database Name
    
    // Here you set the language for the panel
    // If you set this to english, the panel will try to load lang/english.php
    $_CONFIG[Language]  = "english";
    
    // Gunz Database Configuration
    $_CONFIG[AccountTable]  = "Account";
    $_CONFIG[LoginTable]    = "Login";
    $_CONFIG[CharTable]     = "Character";
    $_CONFIG[CItemTable]    = "CharacterItem";
    $_CONFIG[AItemTable]    = "AccountItem";
    $_CONFIG[ClanTable]     = "Clan";
    $_CONFIG[ClanMembTable] = "ClanMember";
    $_CONFIG[ClanLogTable]  = "ClanGameLog";
    
    // Plugins Configuration
    // To Disable, set the variable to 0
    // To Enable, set the variable to 1
    
    $_CONFIG[CountryBlock]  = 0;        // Add functions to Block / Unblock access to your GunZ Server
                                        // to selected countries
    
    ?>

  4. #4
    Account Upgraded | Title Enabled! ProGunzsoul is offline
    MemberRank
    Jul 2008 Join Date
    332Posts

    Re: [Help]mssql connection to odbc

    Quote Originally Posted by Mocro View Post
    Cant make this to work is it possible to make whole config.php to odbc connection so no mssql connection:

    This is from Emisand's Gunz Admin Panel v3 i want it to connect with odbc
    Code:
    <?php
        if( !ereg("index.php", $_SERVER['PHP_SELF']) )
        {
            header("Location: index.php");
            die();
        }
    
       ///////////////////////////////////
      // Emisand's Gunz Admin Panel /////
     /// -- Configuration File  -- /////
    ///////////////////////////////////
    
    //MSSQL Server configuration
    
    $_MSSQL[Host]   = "COMPUTER\SQLEXPRESS";    // MSSQL Server HOST, it can be an IP Address or a computer name
    $_MSSQL[User]   = "sa";                     // MSSQL User
    $_MSSQL[Pass]   = "";                       // MSSQL Password
    $_MSSQL[DBNa]   = "GunzDB";                 // Gunz Database Name
    
    // Here you set the language for the panel
    // If you set this to english, the panel will try to load lang/english.php
    $_CONFIG[Language]  = "english";
    
    // Gunz Database Configuration
    $_CONFIG[AccountTable]  = "Account";
    $_CONFIG[LoginTable]    = "Login";
    $_CONFIG[CharTable]     = "Character";
    $_CONFIG[CItemTable]    = "CharacterItem";
    $_CONFIG[AItemTable]    = "AccountItem";
    $_CONFIG[ClanTable]     = "Clan";
    $_CONFIG[ClanMembTable] = "ClanMember";
    $_CONFIG[ClanLogTable]  = "ClanGameLog";
    
    // Plugins Configuration
    // To Disable, set the variable to 0
    // To Enable, set the variable to 1
    
    $_CONFIG[CountryBlock]  = 0;        // Add functions to Block / Unblock access to your GunZ Server
                                        // to selected countries
    
    ?>
    From
    Code:
    $_MSSQL[Host]   = "COMPUTER\SQLEXPRESS";    // MSSQL Server HOST, it can be an IP Address or a computer name
    $_MSSQL[User]   = "sa";                     // MSSQL User
    $_MSSQL[Pass]   = "";                       // MSSQL Password
    $_MSSQL[DBNa]   = "GunzDB";                 // Gunz Database Name
    To
    Code:
    $host = "Computer\SQLEXPRESS";
    $user = "sa";
    $pass = "xxxxx";
    $dbname = "GunzDB";
    
    $connect = odbc_connect("Driver={SQL Server};Server={$host}; Database={$dbname}", $user, $pass) or die("Can't connect the MSSQL server.");
    i use this to my panel ;)

    Edit
    if
    Code:
    $host = "Computer\SQLEXPRESS";
    $user = "sa";
    $pass = "xxxxx";
    $dbname = "GunzDB";
    
    $connect = odbc_connect("Driver={SQL Server};Server={$host}; Database={$dbname}", $user, $pass) or die("Can't connect the MSSQL server.");
    Not work try
    Code:
    $host = "Computer\SQLEXPRESS";
    $user = "sa";
    $pass = "xxxx";
    $dbname = "GunzDB";
    
    $connect = odbc_connect("Driver={SQL Server};Server={$host}; Database={$dbname}", $user, $pass) or die("Can't connect the MSSQL server.");
    
    function antisql ( $sql ) {
        return ( str_replace( "'", "''", $sql ) );
    }
    im not sure but its work here

  5. #5
    Mocro.net Mocro is offline
    MemberRank
    Feb 2008 Join Date
    Amsterdam.Location
    891Posts

    Re: [Help]mssql connection to odbc

    Dont work realy need a odbc panel

  6. #6
    2D > 3D Wucas is offline
    MemberRank
    Dec 2008 Join Date
    In your bed :3Location
    2,523Posts

    Re: [Help]mssql connection to odbc

    Dude those arent MSSQL Functions. Anything with a $ is a value <.<

    Functions Used In Emisands Admin Panel 3

    odbc_connect
    odbc_fetch_row
    odbc_exec
    odbc_result
    odbc_errormsg

    All the rest are not associated with just ODBC or MSSQL

    Meaning this is already set up for ODBC, not MSSQL. Maybe if you actually read through the code a bit you would learn that this is true

    For Example:

    Connection Function -
    Code:
    $resource =odbc_connect("Driver={SQL Server};Server={$_MSSQL[Host]}; Database={$_MSSQL[DBNa]}", $_MSSQL[User], $_MSSQL[Pass]) or die(odbc_errormsg)
    Login Function -
    Code:
    function login()
    {
        global $_STR, $_CONFIG, $connection;
        $userid = clean_sql($_POST['userid']);
        $password = clean_sql($_POST['password']);
    
        if( $userid == "" || $password == "" )
        {
            setmessage("Login", $_STR[Login4]);
            redirect("index.php");
            die();
        }
    
        $loginquery =odbc_exec($connection, "
                        SELECT a.AID, a.UserID, a.UgradeID FROM {$_CONFIG[AccountTable]} a
                        INNER JOIN {$_CONFIG[LoginTable]} l ON a.AID = l.AID
                        WHERE l.UserID = '$userid' AND l.Password = '$password'
                        ");
        if( num_rows($loginquery) == 1 )
        {
            $logindata = odbc_fetch_row($loginquery);
            $ugradeid = odbc_result($loginquery, 3);
            if( $ugradeid != 255 && $ugradeid != 254 $ugradeid != 253 && $ugradeid != 0 $ugradeid != 2 //lol )
            {
                setmessage("Login", $_STR[Login5]);
                redirect("index.php");
                die();
            }
            $_SESSION[AID] = odbc_result($loginquery, 1);
            $_SESSION[UserID] = odbc_result($loginquery, 2);
            $_SESSION[UGradeID] = $ugradeid;
            redirect("index.php");
        }
        else
        {
            setmessage("Login", $_STR[Login6]);
            redirect("index.php");
            die();
        }
    }

  7. #7
    Mocro.net Mocro is offline
    MemberRank
    Feb 2008 Join Date
    Amsterdam.Location
    891Posts

    Re: [Help]mssql connection to odbc

    Fixed ty for your help



Advertisement