-
Notifications
You must be signed in to change notification settings - Fork 0
/
display_all.php
59 lines (51 loc) · 1.52 KB
/
display_all.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
$layout_context = 'public';
require_once("static/includes/sessions.php");
require_once("static/includes/functions.php");
if(isset($_SESSION["username"])){
$access = "logged_in";
}
require_once("static/includes/dbsetup.php");
include "static/includes/layouts/open.php";
if (isset($_GET["subject"])){
$selected_subject_id = $_GET["subject"];
if(!is_numeric($selected_subject_id)){
redirect_to("index.php");
}
$selected_subject_id = mysqli_real_escape_string($conn,$selected_subject_id);
$query = "SELECT * FROM subjects WHERE ID = {$selected_subject_id} LIMIT 1";
$result = mysqli_query($conn,$query);
if( (!$result) || mysqli_num_rows($result) < 1){
redirect_to("index.php");
}
$selected_page_id = null;
}
elseif (isset($_GET["page"])){
$selected_page_id = $_GET["page"];
if(!is_numeric($selected_page_id)){
redirect_to("index.php");
}
$selected_page_id = mysqli_real_escape_string($conn,$selected_page_id);
$query = "SELECT * FROM pages WHERE ID = {$selected_page_id} LIMIT 1";
$result = mysqli_query($conn,$query);
if( (!$result) || mysqli_num_rows($result) < 1){
redirect_to("index.php");
}
$selected_subject_id = null;
}
else{
$selected_page_id = null;
$selected_subject_id = null;
}
?>
<div class="container display_all">
<p> select any topic from below:</p>
<?php
include "static/includes/public_navigation.php";
echo message();
display_page_public();
?>
</div>
<?php
include "static/includes/layouts/close.php";
?>