<?php
//error_reporting(0);
session_start();
set_time_limit(0);

//$con = mysql_connect("localhost","ayeshana_medics","Med2tec@medics") OR DIE ("Unable to connect to database! Please try again later.");

//$con = mysql_connect("alhudaap3plcpnl0764.prod.phx3.secureserver.net","alhudaamed2tec","Admin@med2tec") OR DIE ("Unable to connect to database! Please try again later.");

$con = @mysql_connect("naseerhospital.db.12382748.hostedresource.com","naseerhospital","Ash117@softusion") OR DIE ("Unable to connect to database! Please try again later.");

if($con)
{
	//mysql_select_db("ayeshana_med2tec",$con) or die(mysql_error());
	
	//mysql_select_db("alhudaamed2tec",$con) or die(mysql_error());
	
	mysql_select_db("naseerhospital",$con) or die(mysql_error());
	
	define('med2tec',$con);
}

$array = explode('/',$_SERVER['REQUEST_URI']); 



/*echo '<pre>';
print_r($array);
echo '</pre>';
exit;*/

if(isset($_SESSION['security']['user_name'])&&$_SESSION['security']['user_name']!="")
{
	
	
	if(isset($array)&&in_array('signin',$array))
	{
		 
		include("../classes/classUser.php");
		include("../classes/classQueryGlobal.php");
		include("../classes/classFilter.php");
		include("../classes/classMyException.php");
		
		$userInfoOb = new classUser;
		$userInfoOb->retrieveUserAllDataByUserID($_SESSION['security']['user_id']);
		$username = $userInfoOb->getFirstName().' '.$userInfoOb->getLastName();
		
		$file_name = $_SESSION['security']['org_id'].'.php';
		if(file_exists($file_name)) 
		{
			define('prec_print_file',$file_name);
		}
		else
		{
			$file_name = "0".".php";
			define('prec_print_file',$file_name);
		}
		
	}
	else
	{
		header("Location:signin/db.php");
	}
	
}
elseif(!isset($_SESSION['security']['user_name'])&&isset($array)&&in_array('signin',$array))
{
	header("Location:../index.php");
}


date_default_timezone_set('Asia/Karachi'); 

?>