<?php
//echo substr("+67073000032",strlen("+67073000032")-8,strlen("+67073000032"));
//return false;
date_default_timezone_set("Asia/Tokyo");
session_start();
if(!file_exists("controller/libconfig.php")){echo "Your <font color=\"red\"><b>LIBRARY Not Defined</b></font>!.";return false;}require_once('controller/libconfig.php');
if(!file_exists("controller/libhtml.php")){echo "Your <font color=\"red\"><b>LIBRARY HTML Not Defined</b></font>!.";return false;}require_once('controller/libhtml.php');
if(!file_exists("controller/libmsginfo.php")){echo "Your <font color=\"red\"><b>LIBRARY MESSAGE Not Defined</b></font>!.";return false;}require_once('controller/libmsginfo.php');
if(!file_exists("controller/libdefine.php")){echo "Your <font color=\"red\"><b>LIBRARY DEFINE Not Defined</b></font>!.";return false;}require_once('controller/libdefine.php');
if(!file_exists("controller/libinterconn.php")){echo "Your <font color=\"red\"><b>LIBRARY LIB INTERCONNECTION Not Defined</b></font>!.";return false;}require_once('controller/libinterconn.php');
require_once("controller/libdbconn.php");
$clreg=new MY_DEFINE();
$cllib=new MY_HTML();
//echo $cllib->enc('1234');return false;
$cllib->fn_checkmybrowser();
//echo $_SESSION["employeename"]."1234";

$option=trim(strtolower($_REQUEST['option']));
//echo $option;
if($_REQUEST['sec']){$option=$cllib->dec($option);$task=$cllib->dec($_REQUEST['task']);}
if($option){$pg=substr($option,4,strlen($option)-4);}
if($_POST['uri'])
{
    $uri=$cllib->uri_parsing($_POST['uri']);
    $sp=explode("|",$uri);
    $ajax=$sp[0];
    $sec=$sp[1];
    $option=$cllib->dec($sp[2]);
    $sppage=explode("_",$option);$pg=$sppage[1];
    $obj=$cllib->dec($sp[3]);
    $task=$cllib->dec($sp[4]);
}
// === PHP Excel On
if($_REQUEST['xlson']){$myfile="xlsdoc/".$cllib->dec($_REQUEST['xls']).".php";require_once($myfile);exit;}


if($option=="r/log")
{     
    if($cllib->login()){$cllib->mosRedirect('?'.PROJECTID);}    
}
elseif($option=="r/out") 
{
	$cllib->logout();
	$cllib->mosRedirect('?'.PROJECTID);
}

//if(!session_is_registered($_SESSION["namaemployee"]))
if(!($_SESSION["employeename"])){require_once(LOGIN_PAGE);}
else
{   
//echo "FDF";
    if($_REQUEST['ajax']){$ajax=$_REQUEST['ajax'];}
    if($_POST['ajax']){$ajax=$_POST['ajax'];}    
    
    if($ajax)
    {
        //echo $option." ".$pg;
        require_once(PATH_OBJECT."/$option/$pg.php");
    }
    else
    {
        //echo $ajax;
        if(isset($_REQUEST['popup'])){require_once(PATH_OBJECT."/$option/$pg.php");} 
        else
        {require_once(PATH_THEME."/index.php");}
    }
}
?>

