-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
35 lines (31 loc) · 944 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php require('./utils/array_utils.php'); ?>
<?php require('./utils/db_connector_prod.php'); ?>
<?php
// check 'action' from get params
if(!array_key_exists("action", $_GET)){
header("Location: ?action=home");
exit(0);
}
// get action value from action key in $_GET
$action = $_GET['action'];
?>
<?php require('./partials/header.php'); ?>
<?php
// filter only php extension
$filter_file_name = array_filter(scandir("./"), "filter_php_file");
$page_php_path = "{$action}.php";
if(in_array($page_php_path, $filter_file_name, true))
include($page_php_path);
else
include("404.php");
// include essentails scripts
require("./partials/scripts.php");
// include script control withit page
$page_script_path = "scripts/{$action}.js";
if(file_exists($page_script_path)){
echo "<script>";
include($page_script_path);
echo "</script>";
}
?>
<?php require("./partials/footer.php"); ?>