-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_blog.php
140 lines (119 loc) · 4.74 KB
/
edit_blog.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
require_once 'assets/config/config.php';
require_once "vendor/autoload.php";
use PhotoTech\ErrorHandler;
use PhotoTech\Database;
use PhotoTech\LoginRepository as Login;
use PhotoTech\ImageContentManager as CMS;
$errorHandler = new ErrorHandler();
// Register the exception handler method
set_exception_handler([$errorHandler, 'handleException']);
$database = new Database();
$pdo = $database->createPDO();
$login = new Login($pdo);
if (!$login->check_login_token()) {
header('location: index.php');
exit();
}
$cms = new CMS($pdo);
$records = $cms->headings();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=yes, initial-scale=1.0">
<title>Edit Page</title>
<link rel="stylesheet" media="all" href="assets/css/stylesheet.css">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
</head>
<body class="site">
<header class="headerStyle">
</header>
<div class="nav">
<input type="checkbox" id="nav-check">
<div class="nav-btn">
<label for="nav-check">
<span></span>
<span></span>
<span></span>
</label>
</div>
<div class="nav-links">
<?php $database->regular_navigation(); ?>
</div>
<div class="name-website">
<h1 class="webtitle">The Photo Tech Guru</h1>
</div>
</div>>
<main class="main_container">
<div class="home_article">
<form id="data_entry_form" class="checkStyle" action="edit_blog.php" method="post" enctype="multipart/form-data">
<input id="id" type="hidden" name="id" value="">
<input type="hidden" name="user_id" value="<?= $_SESSION['user_id'] ?>">
<input type="hidden" name="author" value="John Pepp>">
<input type="hidden" name="page" value="gallery">
<input type="hidden" name="action" value="upload">
<div id="image_display_area">
<img id="image_for_edited_record" src="" alt="">
</div>
<div id="file_grid_area">
<input id="file" class="file-input-style" type="file" name="image">
<label for="file">Select file</label>
</div>
<label id="select_grid_category_area">
<select class="select-css" name="category">
<option id="category" value=""></option>
<option value="general">General</option>
<option value="lego">LEGO</option>
<option value="halloween">Halloween</option>
<option value="landscape">Landscape</option>
<option value="wildlife">Wildlife</option>
</select>
</label>
<div id="heading_heading_grid_area">
<label class="heading_label_style" for="heading">Heading</label>
<input class="heading" class="enter_input_style" type="text" name="heading" value="" tabindex="1" required >
</div>
<div id="content_style_grid_area">
<label class="text_label_style" for="content">Content</label>
<textarea class="text_input_style" id="content" name="content" tabindex="2"></textarea>
</div>
<div id="submit_picture_grid_area">
<button class="form-button" type="submit" name="submit" value="enter">submit</button>
</div>
</form>
</div>
<div class="home_sidebar">
<div class="search-form-container">
<form id="searchForm">
<div class="input-group">
<label for="searchTerm">Search:</label>
<input type="text" placeholder="Search Content" id="searchTerm" class="input-field" autofocus required>
</div>
<div class="input-group">
<label for="heading">Heading:</label>
<select class="select-css" id="heading" name="heading">
<option value="" disabled selected>Select Heading</option>
<?php
foreach ($records as $record) {
echo '<option value="' . $record['heading'] . '">' . $record['heading'] . '</option>';
}
?>
</select>
</div>
<button class="search_button" type="submit">Search</button>
</form>
</div>
<?php $database->showAdminNavigation(); ?>
</div>
</main>
<aside class="sidebar">
</aside>
<footer class="colophon">
<p>© <?php echo date("Y") ?> The Photo Tech Guru</p>
</footer>
<script src="assets/js/edit_blog.js"></script>
</body>
</html>