<? session_start();

$host       = "localhost";
$dbname     = "ahresortmy_newfi";
$dbusername = "ahresortmy_usenfi";
$dbpassword = 'O2rb17Iuah3j';

//ini_set('display_errors', 'Off');



function db_connect()

 {

	 global $host,$dbusername,$dbpassword,$dbname;

	 if(!($link_id=mysql_pconnect($host,$dbusername,$dbpassword)))

	   {

         echo("error connecting to host");

         exit();

       }

	 if(!mysql_select_db($dbname,$link_id))

	   {

		 echo("error in selecting the database");

		 echo(sprintf("Error : %d %s",mysql_errno($link_id),mysql_error($link_id)));

	   }

		return $link_id;

 }//function



$link_id = db_connect();

//mysql_close($con);



// To make the date format in usual

function dtformat($dt){

         list ($year, $month, $day) = split ('[-./]', $dt);

         $dt=$day."-".$month."-".$year;

         return $dt;

}



// To make the date format in usual

function mydate1($dt){

	if($dt!="0000-00-00"){

		list ($year, $month, $day) = split ('[-./]', $dt);

		$dt= date ("F d, Y", mktime (0,0,0,$month,$day,$year));

	}else{

		$dt="<font color='#ff6622'>Not Set</font>";

	}

	return $dt;

}

function mydate2($dt){

	if($dt!="0000-00-00"){

		list ($year, $month, $day) = split ('[-./]', $dt);

		$dt= date ("d-M-Y", mktime (0,0,0,$month,$day,$year));

	}else{

		$dt="<font color='#ff6622'>Not Set</font>";

	}

	return $dt;

}

$date2=date("Y-m")."-01";

	$timestamp2=strtotime($date2);

	$mf=date('Y-m-d', $timestamp2);

	

	//--next month

	$mes= mktime(0,0,0,date("m")+1,01,date("Y"));

	$me=date("Y-m-d", $mes);

//$tdate=dtformat($date);

$date=date("Y-m-d"); 
$date1ah=date("Y-m-d"); 


$dat=date("Y-m-d");

$h=date("H")+6;

$hour=date("i:s");

$datetime="$dat $h:$hour";


function getUserIP() {
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ipList = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
        $ip = trim($ipList[0]); // first IP
    } else {
        $ip = $_SERVER['REMOTE_ADDR'];
    }

    return $ip;
}


?>