-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_panel.php
90 lines (80 loc) · 3.93 KB
/
admin_panel.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
session_start();
if( ! isset($_SESSION['logged_in']) || ! isset($_SESSION['csrf_token'])){
exit('<h1> 405 Method Not Allowed </h1>');
}
if(!($_SESSION['logged_in'] == true)){
echo('<h1>You are not loged in!</h1><br>');
exit('<h1>Log in first to access tis page!</h1>');
}
require('functions/dbconn.php');
try{
$sql = "SELECT admin_panel_css_settings FROM rob_settings WHERE active_settings = 1"; //+add in database new table containnig links icons etc. or ad columns to settings table and get them as varibles here to be used inside get_settings_set_for_admin_panel.php
foreach ($conn->query($sql) as $row){
$admin_panel_css_settings = $row['admin_panel_css_settings'];
}
}
catch(PDOException $e) {
echo "Error: " . $e->getMessage();
$conn = null;
}
$csrf_token_settings = bin2hex(random_bytes(20));
$_SESSION['csrf_token_settings'] = $csrf_token_settings;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ROB Admin Panel</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<link rel="stylesheet" href=<?php echo("css/".$admin_panel_css_settings."admin_panel.css"); ?>>
</head>
<body>
<header>
<div class="container-fluid">
<div class="row justify-content-center">
<div class="col-12 header"><h1>Welcome in Admin Panel!</h1></div>
</div>
</div>
</header>
<div class="container">
<div class="row justify-content-center">
<div class="col-12">
<nav>
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="admin_panel.php">Settings</a>
</li>
<li class="nav-item">
<a class="nav-link" href="add_post.php">Add Post</a><!-- Creates post taht is not visible and redirects to Editor (same as edit post redirects after selecting post to edit) post with ID of new post. -->
</li>
<li class="nav-item">
<a class="nav-link" href="edit_post.php">Edit Posts</a>
</li>
<li class="nav-item">
<a class="nav-link" href="pages.php">Pages</a>
</li>
<li class="nav-item">
<a class="nav-link" href="documentation.php">Documentation</a>
</li>
</ul>
<a class="nav-link" href="functions/logout.php"><button class="btn btn-danger log_out">Logout</button></a>
</nav>
<main class="main">
<a href="#goto_footer_links"><button class="btn btn-primary" style="margin: 40px 0 0 20px;"><b>Go to -> Footer links</b></button></a>
<?php require('functions/admin_panel_main.php'); ?>
<form action="functions/add_settings_set.php" method="post" style="padding: 20px; border-top: 1px solid #dee2e6;">
<input type="hidden" name="csrf_token_settings" value="<?php echo($csrf_token_settings); ?>">
<button type="submit" class="btn btn-primary">Add settings set</button>
</form>
</main>
</div>
</div>
</div>
</body>
</html>
<?php
$conn = null;
?>