This repository has been archived by the owner on Jul 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·62 lines (52 loc) · 2.1 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
60
61
62
<?php
$page = "home"; //default page is home
$category = '';
//Check to see if page is set and check to see if php file exists
//for the particular page being requested
if (isset($_GET['page']) && file_exists("templates/" . $_GET['page'] . ".php")) {
$page = preg_replace("/[^A-Za-z0-9_]/", "", $_GET['page']);
}
else if (isset($_GET['category'])) {
$category = $_GET['category'];
}
require_once('classes/Application.php');
require_once('classes/Database.php');
require_once('classes/User.php');
require_once('classes/HTMLGen.php');
//Create and start the user object
$user = new AO_User();
$user->start();
?>
<!DOCTYPE html>
<html lang="en">
<?php
require("templates/header.php");
?>
<body>
<div class="container">
<?php
require("templates/navigation.php"); //navigation of the page
//Check to see if action is set, if so, data is being sent in and needs
//to be handled by the appropriate page (in form_actions)
if (isset($_REQUEST['action'])) {
//Replace spaces with underscores
$form = str_replace(" ", "_", $_REQUEST['action']);
$form = preg_replace("/[^A-Za-z0-9_]/", "", $form);
//Check to see if php file corresponding to action exists and include
//the code if it does, else report an error
if (file_exists("form_actions/" . $form . ".php")) {
require_once('form_actions/' . $form . ".php");
} else {
echo "<p>Invalid form action specified</p>";
}
} else {
//If data is not being submitted, display the appropriate page
require("templates/" . $page . ".php");
}
require("templates/footer.php"); //footer of the page
?>
</div> <!-- /container -->
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="assets/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>