<?php
session_start();
if($_SERVER['SERVER_NAME']===DOMAIN_NAME) include "CONFIG/config.php"; else include "CONFIG/config-local.php";
$GLOBALS['alert_info']="";$GLOBALS['post_info']="";
foreach (glob("DIZ/FN/*.php") as $filename) include $filename; //to include DIZ-PHP's built-in functions
foreach (glob("CONTENT/FN_C/*.php") as $filename) include $filename; //to include this APP's functions
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if(isset($_POST['FORM_NAME']) && $_POST['FORM_NAME']!==""){
      // Some security implementation needed
      $form_processor="CONTENT/POST_ACTION/".$_POST['FORM_NAME'].".php";
      if(file_exists($form_processor)) include $form_processor; else { $FormReply= new stdClass();$FormReply->info = "Form handler not found !"; }//Ajax Form Notification
  }else {$FormReply= new stdClass();$FormReply->info = "Form handler not Defiened !";}
}
//echo $url[F_D+2];
//echo $url[F_D+1]; var_dump($url);
// URI Handler with Folder_Depth

// if(isset($url[F_D+2])) {
//   $lnk=$url[F_D+2];
//   if(file_exists("CONTENT/ROOT_URI/".$url[F_D+1]."/index.php")) include "CONTENT/ROOT_URI/".$url[F_D+1]."/index.php";
//   else  {$Notify= new stdClass();$Notify->info = "Form handler not found !";}
// } else {
//   $lnk=$url[F_D+1];
//   include "CONTENT/ROOT_URI/index.php";
// }

if(isset($url[F_D+2]) && file_exists("CONTENT/ROOT_URI/".$url[F_D+1]."/index.php")) {$inc=$url[F_D+1]; //echo $inc."<br>";
  if(isset($url[F_D+3]) && file_exists("CONTENT/ROOT_URI/".$inc."/".$url[F_D+2]."/index.php")) {$inc=$inc."/".$url[F_D+2]; //echo $inc."<br>";
    if(isset($url[F_D+4]) && file_exists("CONTENT/ROOT_URI/".$inc."/".$url[F_D+3]."/index.php")) {$inc=$inc."/".$url[F_D+3]; //echo $inc."<br>";
      if(isset($url[F_D+5]) && file_exists("CONTENT/ROOT_URI/".$inc."/".$url[F_D+4]."/index.php")) {$inc=$inc."/".$url[F_D+4]; //echo $inc."<br>";
        if(isset($url[F_D+6]) && file_exists("CONTENT/ROOT_URI/".$inc."/".$url[F_D+5]."/index.php")) {$inc=$inc."/".$url[F_D+5]; //echo $inc."<br>";
          if(isset($url[F_D+7]) && file_exists("CONTENT/ROOT_URI/".$inc."/".$url[F_D+6]."/index.php")) {$inc=$inc."/".$url[F_D+6]; //echo $inc."<br>";
            if(isset($url[F_D+8]) && file_exists("CONTENT/ROOT_URI/".$inc."/".$url[F_D+7]."/index.php")) {$inc=$inc."/".$url[F_D+7]; //echo $inc."<br>";
              if(isset($url[F_D+9]) && file_exists("CONTENT/ROOT_URI/".$inc."/".$url[F_D+8]."/index.php")) {$inc=$inc."/".$url[F_D+8]; //echo $inc."<br>";
                if(isset($url[F_D+10]) && file_exists("CONTENT/ROOT_URI/".$inc."/".$url[F_D+9]."/index.php")) {$inc=$inc."/".$url[F_D+9]; //echo $inc."<br>";
                  $lnk=$url[F_D+10];
                  include "CONTENT/ROOT_URI/".$inc."/index.php";
                  }
                else {$lnk=$url[F_D+9];include "CONTENT/ROOT_URI/".$inc."/index.php";}
              }
              else {$lnk=$url[F_D+8];include "CONTENT/ROOT_URI/".$inc."/index.php";}
            }
            else {$lnk=$url[F_D+7];include "CONTENT/ROOT_URI/".$inc."/index.php";}
          }
          else {$lnk=$url[F_D+6];include "CONTENT/ROOT_URI/".$inc."/index.php";}
        }
        else {$lnk=$url[F_D+5];include "CONTENT/ROOT_URI/".$inc."/index.php";}
      }
      else {$lnk=$url[F_D+4];include "CONTENT/ROOT_URI/".$inc."/index.php";}
    }
    else {$lnk=$url[F_D+3];include "CONTENT/ROOT_URI/".$inc."/index.php";}
  }
  else {$lnk=$url[F_D+2];include "CONTENT/ROOT_URI/".$inc."/index.php";}
}
else {$lnk=$url[F_D+1];include "CONTENT/ROOT_URI/index.php";}