Exemple #1
0
                    $arr['page'] = $urlArr[1];
                }
            } else {
                $arr['control'] = CONS_FILE_DETAIL;
                $arr['link'] = $urlArr[0];
                $arr['page'] = str_replace('.html', '', $urlArr[1]);
                header('HTTP/1.1 301 Moved Permanently');
                header('location: ' . CONS_BASE_URL . '/' . $arr['page']);
                return true;
            }
            return $arr;
    }
}
$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$url = str_replace(CONS_BASE_URL . '/', '', $url);
$arrUrl = tachUrl($url);
$fileController = "controllers/{$arrUrl['control']}.php";
if (file_exists($fileController)) {
    include_once $fileController;
} else {
    echo ERROR_NOT_FOUND_CONTROLLER . $fileController;
}
function __autoload($fileName)
{
    $fileControl = "controllers/{$fileName}.php";
    $fileModel = "models/{$fileName}.php";
    if (file_exists($fileControl)) {
        include_once $fileControl;
    }
    if (file_exists($fileModel)) {
        include_once $fileModel;
Exemple #2
0
        $str = CONS_WEB_HOME_PAGE;
    } else {
        $regex = '/(.*)*.html$/';
        if (!preg_match($regex, $url)) {
            $str = CONS_WEB_MENU_PAGE;
        } else {
            $str = CONS_WEB_DETAIL_PAGE;
        }
    }
    return $str;
}
$url = $_SERVER['REQUEST_URI'];
//$url = preg_replace('/\//', '', $url, 1);
$url = str_replace(CONS_BASE_DIR, '', $url);
/*Upload host tat dong nay*/
$control = tachUrl($url, $arrUrl);
$fileController = "controllers/{$control}.php";
if (file_exists($fileController)) {
    include_once $fileController;
} else {
    echo ERROR_NOT_FOUND_CONTROLLER;
}
function __autoload($className)
{
    $fileControl = "controllers/{$className}.php";
    $fileModel = "models/{$className}.php";
    if (file_exists($fileControl)) {
        include_once $fileControl;
    }
    if (file_exists($fileModel)) {
        include_once $fileModel;