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

Размер файла: 1.01Kb
<?
/**
 * @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;
    }

	/*
	 * Подключение к базе данных MYSQL
	 */
    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);
        mysql_query('set charset utf8',$db); 
        mysql_query('set character_set_client="utf8"',$db); 
        mysql_query('set character_set_connection="utf8"',$db); 
        mysql_query('set character_set_result="utf8"',$db);

    }
}

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



?>