<?php
//for hosting hostname , user, db sarver password

$DB_HOST = 'localhost';
$DB_NAME = 'avenircms';
$DB_USER = "yrgbs";
$DB_PASS ="(5gVtQ6=h.Hs";
$DB_PORT = '3306';
$DB_TYPE = 'mysql';

$DB_HOSTNAME = $DB_HOST.':'.$DB_PORT;
$dsn = $DB_TYPE."://".$DB_USER.":".$DB_PASS."@".$DB_HOSTNAME."/".$DB_NAME;
define("DSN",$dsn);
define("WWW_DOC_ROOT", 'https://'.$_SERVER['HTTP_HOST']."/avenircms/");

// define("DOC_ROOT", substr($_SERVER['PHP_SELF'], 1, strrpos($_SERVER['PHP_SELF'],"/")-1));

$php_self = split("/", $_SERVER['PHP_SELF']);
$doc_root = $php_self[(count($php_self)-1)];
define("DOC_ROOT", $doc_root);
// define("DT_FMT",'dd-mm-yyyy');
date_default_timezone_set('Asia/Calcutta');

define("PEAR", getcwd().'/includes/PEAR');

define("SITE_URL",'http://'.$_SERVER['HTTP_HOST']."/".basename(getcwd()).'/index.php');

require('includes/sql.lib.php');

$includeDirectory = getcwd().'/includes/PEAR';

ini_set('include_path', $includeDirectory . PATH_SEPARATOR . ini_get('include_path'));

require_once 'DB.php';
// database configuration
class Project_SQL extends SQL {

    function Project_SQL() {
        $this->connect(DSN) || die('could not connect to database '.$DB_NAME);
    }
}
class Survey_SQL extends SQL {

    function Survey_SQL($survey_dsn)
	{
		$SUR_DB_HOST = $survey_dsn['host'];
		$SUR_DB_NAME = $survey_dsn['dbname'];
		$SUR_DB_USER = $survey_dsn['dbuser'];
		$SUR_DB_PASS = $survey_dsn['dbpass'];
		$SUR_DB_PORT = '3306';
		$SUR_DB_TYPE = 'mysql';
		
		$SUR_DB_HOSTNAME = $SUR_DB_HOST.':'.$SUR_DB_PORT;
		$sur_dsn = $SUR_DB_TYPE."://".$SUR_DB_USER.":".$SUR_DB_PASS."@".$SUR_DB_HOSTNAME."/".$SUR_DB_NAME;
		
        $this->connect($sur_dsn) || die('could not connect to database '.$SUR_DB_NAME);
    }
}
// $sql =& new Project_SQL;

define("USR", isset($_SESSION['TER']["user"]) ? $_SESSION['TER']["user"] : "");
define("USRNME", isset($_SESSION['TER']["user_name"]) ? $_SESSION['TER']["user_name"] : "");
?>