Location: PHPKode > scripts > Ramui web hosting directory script > Ramui web hosting directory script/gb/include/connection.php
<?php
/*
Copyright (c) 2011 http://ramui.com. All right reserved.
This product is protected by copyright and distributed under licenses restricting copying, distribution. Permission is granted to the public to download and use this script provided that this Notice and any statement of authorship are reproduced in every page on all copies of the script.
*/
class connection
{
protected $prefix;
protected $site;
public $error=false;
protected $admin=false;
function __construct($root)
{
        include $root."database/config.php";
        $con=@mysql_connect($dbhost,$dbuser,$dbpw);
        if(!($con)){$this->error="Database connection error";return;}
        if(!(@mysql_select_db($dbname))){$this->error="Database not found!";return;}
        $this->prefix=$prefix;
        $query  = "SELECT* FROM ".$prefix."settings";
        $result = @mysql_query($query);
        if(!$result){$this->error="No site information!";return;}
        $this->site = @mysql_fetch_array($result, MYSQL_ASSOC);
		$this->validate_user();
}
private function validate_user()
{
        $query  = "SELECT login, session FROM ".$this->prefix."admin";
        $result = @mysql_query($query);
        $row = @mysql_fetch_array($result, MYSQL_ASSOC);
        $this->admin=(isset($_SESSION['fw_admin'])&&($_SESSION['fw_admin']===$row['session']) && ($_SERVER['REMOTE_ADDR']==$row['login']));
}
public function get_prefix(){return $this->prefix;}
public function siteinf($param=''){return((empty($param))? $this->site : $this->site[$param]);}
public function get_admin(){return $this->admin;}
}
?>
Return current item: Ramui web hosting directory script