X7chat2 0 0 > Lib / Db / Mysql.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
X7chat2 0 0

Download:
x7chat2-0-0.zip

Category:
Chat Scripts

Archive Content:

X7chat2 0 0

X7chat2 0 0 > Sources

X7chat2 0 0 > Lang

X7chat2 0 0 > Uploads

X7chat2 0 0 > Lib

X7chat2 0 0 > Lib > Db

X7chat2 0 0 > Lib > Auth

X7chat2 0 0 > Lib

X7chat2 0 0 > Themes

X7chat2 0 0 > Themes > Template

X7chat2 0 0 > Themes > Apex

X7chat2 0 0 > Themes > Install.images

X7chat2 0 0 > Themes > X7chat2

X7chat2 0 0 > Themes > Supportimages

X7chat2 0 0 > Themes > Nadir

X7chat2 0 0 > Themes > X7chat2 Alpha

X7chat2 0 0 > Themes

X7chat2 0 0 > Logs

X7chat2 0 0 > Fonts

X7chat2 0 0 > Help

X7chat2 0 0 > Help > Images

X7chat2 0 0 > Help

X7chat2 0 0 > Mods

X7chat2 0 0 > Sounds

X7chat2 0 0 > Smilies

X7chat2 0 0 > Docs

X7chat2 0 0 > Docs > Install.invisionboard1

X7chat2 0 0 > Docs > Install.invisionboard2

X7chat2 0 0 > Docs > Install.mcboard

X7chat2 0 0 > Docs > Install.phpbb2

X7chat2 0 0 > Docs > Install.smf

X7chat2 0 0 > Docs > Install.xmb

X7chat2 0 0 > Docs

X7chat2 0 0

Mysql.php:


<?PHP
/////////////////////////////////////////////////////////////// 
//
//        X7 Chat Version 2.0.0
//        Released July 27,  2005
//        Copyright (c) 2004-2005 By the X7 Group
//        Website: http://www.x7chat.com
//
//        This program is free software.  You may
//        modify and/or redistribute it under the
//        terms of the included license as written  
//        and published by the X7 Group.
//  
//        By using this software you agree to the         
//        terms and conditions set forth in the
//        enclosed file "license.txt".  If you did
//        not recieve the file "license.txt" please
//        visit our website and obtain an official
//        copy of X7 Chat.
//
//        Removing this copyright and/or any other
//        X7 Group or X7 Chat copyright from any
//        of the files included in this distribution
//        is forbidden and doing so will terminate
//        your right to use this software.
//    
////////////////////////////////////////////////////////////////EOH
?><?PHP

    
// This class handles database communication
    
class x7chat_db {
        var 
$con;        // MySql resource
        
var $database;        // MySql database resource
        
var $error;        // Stores error message (used for install file and debugging)
        
        // This function handles running a query
        
function DoQuery($query){
            
$q mysql_query($query, $this->con);    // Run the query
            
if(mysql_error() == ""){        // If MySql doesn't sends back an error then
                
return $q;            // return resource ID
            
}else{
                
$this->error 4;
                return 
mysql_error();    // otherwise return the error
            
}
        }

        
// Get a row from the database
        
function Do_Fetch_Row($q){
            
$row mysql_fetch_row($q);    // Get the row
            
return $row;            // Return it
        
}
        
        
// Make the database connection and select the correct database
        
function x7chat_db($host="", $uname="", $pword="", $db="", $die=1){
            global 
$X7CHAT_CONFIG;        // Get the values from the config file
            
if($host == ""){
                
$host $X7CHAT_CONFIG['DB_HOST'];
                
$uname $X7CHAT_CONFIG['DB_USERNAME'];
                
$pword $X7CHAT_CONFIG['DB_PASSWORD'];
                
$db $X7CHAT_CONFIG['DB_NAME'];
            }
            
            
$this->error 0;
            
            if(
$X7CHAT_CONFIG['USE_PCONNECT'] == 1){
                
$this->con = @mysql_pconnect($host, $uname, $pword);
            }else{
                
$this->con = @mysql_connect($host, $uname, $pword);
            }
            
            
$this->database = @mysql_select_db($db, $this->con);        // Select the database
            
if(!$this->con){
                if(
$die){
                    die(
"Error connecting to database");        // If it fails print an error and exit
                
}else{
                    
$this->error 2;
                    return 
0;
                }
            }
            if(!
$this->database){
                if(
$die){
                    die(
"Error selecting database");        // If it fails print an error and exit
                
}else{
                    
$this->error 3;
                    return;
                }
            }
        }
        
    }
?>



Other Chat Scripts Scripts:

WebMaster Resources Home

©RingsWorld.com