-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·59 lines (44 loc) · 1.44 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/*
* ======================================
* Nama : Fattahul Akbar
* email : [email protected]
* company : Creative Software House
* ======================================
*/
error_reporting(E_ALL);
//Nama folder aplikasi
$application_folder = 'applications';
define('ROOT', str_replace("\\", "/", realpath(dirname(__FILE__))) . '/');
//Menentukan BASEPATH sebagai root aplikasi
define('BASEPATH', ROOT . $application_folder . '/');
//Awal output buffering
ob_start();
session_start();
//Menjalankan program melalui router
require BASEPATH . 'core/router.php';
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
$router = new Router();
$router->do_request();
//Akhir output buffering
@ob_end_flush();
//Tampilan Error
function show_error($message = ''){
ob_end_clean();
$error = '<html><head><title>Error</title>';
$error .= '<style type="text/css">';
$error .='body {margin:0; padding:0; font-family: sans-serif; color:#222;}';
$error .= '#error {margin: 30px auto; width: 600px; '.
' border: 2px crimson solid; padding: 10px; '.
' background: pink; text-align: center;}';
$error .= '</style>';
$error .= '</head><body><div id="error">';
if($message == ''){
$message = '<b>404 -Page not found!</b>';
}
$error .= $message;
$error .= '</div></body></html>';
exit ($error);
}
?>