commit
This commit is contained in:
36
index.php
Normal file
36
index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
// /www/kngil/index.php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// ---------------------------------
|
||||
// 1. 기본 상수
|
||||
// ---------------------------------
|
||||
define('ROOT', __DIR__);
|
||||
define('SKIN_PATH', ROOT.'/skin');
|
||||
|
||||
// ---------------------------------
|
||||
// 2. 페이지 결정
|
||||
// ---------------------------------
|
||||
$page = $_GET['page'] ?? 'index';
|
||||
|
||||
// 파일명 보안 필터
|
||||
$page = preg_replace('/[^a-zA-Z0-9_\-]/', '', $page);
|
||||
|
||||
// ---------------------------------
|
||||
// 3. skin 파일 매핑
|
||||
// ---------------------------------
|
||||
$viewFile = SKIN_PATH.'/'.$page.'.php';
|
||||
|
||||
// ---------------------------------
|
||||
// 4. 존재 여부 체크
|
||||
// ---------------------------------
|
||||
if (!is_file($viewFile)) {
|
||||
http_response_code(404);
|
||||
exit('404 NOT FOUND');
|
||||
}
|
||||
|
||||
// ---------------------------------
|
||||
// 5. 화면 위임
|
||||
// ---------------------------------
|
||||
require $viewFile;
|
||||
Reference in New Issue
Block a user