Просмотр файла system/inc/classes/connection.class.php

Размер файла: 849B
<?
/**
 * @name SHCMS Engine
 * @copyright Shamsik © 2012
 */
 
class connection
{
	/*
     * Соединение с базой данных
     */
    private $dbhost;
    private $dbname;
    private $dbuser;
    private $dbpass;

    function __construct()
    {
       $this->dbhost = DBHOST; 
       $this->dbuser = DBUSER;
       $this->dbpass = DBPASS;
       $this->dbname = DBNAME;
    }


    public function connect()
    {
       $db = mysql_connect($this->dbhost,
	                       $this->dbuser,
						   $this->dbpass) or die ("Не удалось подключиться с серверу ".$this->dbhost."");
						   
        mysql_select_db($this->dbname,$db);
        mysql_query("SET NAMES 'utf8'", $db);
    }
}

  $dbconnect = new connection;
  $dbconnect -> connect();



?>