-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit.php
305 lines (223 loc) · 10.3 KB
/
edit.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
<?php
session_start();
//print_r();
include("classes/autoloader.php");
//isset($_SESSION['NFoster_userid'];
$login = new Login();
$user_data = $login->check_login($_SESSION['NFoster_userid']);
$USER = $user_data;
//
if(isset($_GET['id']) && is_numeric($_GET['id']))
{
$profile = new Profile();
$profile_data = $profile->get_profile($_GET['id']);
if(is_array($profile_data))
{
$user_data = $profile_data[0];
}
}
$image_class = new Image();
$ERROR = "";
$Post = new Post();
if(isset($_GET['id']))
{
$ROW = $Post->get_one_post($_GET['id']);
if(!$ROW)
{
$ERROR = "No such Post was found !";
}else {
if($ROW['userid'] != $_SESSION['NFoster_userid'])
{
$ERROR = "Access Denied! you cant delete this post.";
}
}
}else{
$ERROR = "No such Post was found !";
}
//$_SESSION['return_to'] = "profile.php";
if(isset($_SERVER['HTTP_REFERER']) && !strstr($_SERVER['HTTP_REFERER'],"edit.php"))
{
$_SESSION['return_to'] = $_SERVER['HTTP_REFERER'];
}
//if something was posted
if($_SERVER['REQUEST_METHOD'] == "POST")
{
$Post->edit_post($_POST,$_FILES);
header("Location: " . $_SESSION['return_to']);
die;
}
?>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>N.F - Network Fostere</title>
<meta name="robots" content="noindex, follow" />
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="assets/images/favicon.ico">
<!-- CSS
============================================ -->
<!-- google fonts -->
<link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i,700,700i,900" rel="stylesheet">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="assets/css/vendor/bootstrap.min.css">
<!-- Icon Font CSS -->
<link rel="stylesheet" href="assets/css/vendor/bicon.min.css">
<!-- Flat Icon CSS -->
<link rel="stylesheet" href="assets/css/vendor/flaticon.css">
<!-- audio & video player CSS -->
<link rel="stylesheet" href="assets/css/plugins/plyr.css">
<!-- Slick CSS -->
<link rel="stylesheet" href="assets/css/plugins/slick.min.css">
<!-- nice-select CSS -->
<link rel="stylesheet" href="assets/css/plugins/nice-select.css">
<!-- perfect scrollbar css -->
<link rel="stylesheet" href="assets/css/plugins/perfect-scrollbar.css">
<!-- light gallery css -->
<link rel="stylesheet" href="assets/css/plugins/lightgallery.min.css">
<!-- Main Style CSS -->
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<!-- header area start -->
<header>
<div class="header-top sticky bg-white d-none d-lg-block">
<div class="container">
<div class="row align-items-center">
<div class="col-md-5">
<!-- header top navigation start -->
<div class="header-top-navigation">
<nav>
</nav>
</div>
<!-- header top navigation start -->
</div>
<div class="col-md-2">
<!-- brand logo start -->
<div class="brand-logo text-center">
<a href="index.html">
<img src="assets/images/logo/logo.png" alt="brand logo">
</a>
</div>
<!-- brand logo end -->
</div>
</div>
</div>
</div>
</header>
<!-- header area end -->
<!-- header area start -->
<header>
<div class="header-top sticky bg-white d-none d-lg-block">
<div class="container">
<div class="row align-items-center">
<div class="col-md-5">
<!-- header top navigation start -->
<div class="header-top-navigation">
<nav>
<ul>
<li class="active"><a href="main.php">Timeline</a></li>
<li class="msg-trigger"><a href="friends.php">Friends</a></li>
<li class="notification-trigger"><a href="profile.php">My Profile</a></li>
</ul>
</nav>
</div>
<!-- header top navigation start -->
</div>
<div class="col-md-2">
<!-- brand logo start -->
<div class="brand-logo text-center">
<a href="main.php">
<img src="assets/images/logo/logo.png" alt="brand logo">
</a>
</div>
<!-- brand logo end -->
</div>
<div class="col-md-5">
<div class="header-top-right d-flex align-items-center justify-content-end">
<!-- header top search start -->
<div class="header-top-search">
<form class="top-search-box">
<input type="text" placeholder="Search" class="top-search-field">
<button class="top-search-btn"><i class="flaticon-search"></i></button>
</form>
</div>
<!-- header top search end -->
</div>
</div>
</div>
</div>
</div>
</header>
<!-- header area end -->
<main>
<div class="main-wrapper pt-80">
<div class="container">
<div class="row">
<div class="col-lg-3 order-2 order-lg-1">
<aside class="widget-area">
</aside>
</div>
<div class="col-lg-6 order-1 order-lg-2">
<div class="card card-small">
<div class="share-box-inner">
<div class="share-content-box w-100">
<form method = "post" enctype = "multipart/form-data" class = "share-text-box">
<?php
if($ERROR != "")
{
echo $ERROR;
}else
{
echo "<h5>Edit Post?</h5><hr>";
echo("<b>post description</b>");
echo '<div class="share-content-box w-100">
<textarea name="post" class="share-field-big custom-scroll" placeholder="Say Something">' .$ROW['post'].'</textarea>
<br><br><input type="file" name="file"><br><br>
</div>';
echo "<input type='hidden' name='postid' value = '$ROW[postid]'; >";
echo "<input type='submit' value = 'Save' class ='btn-share'>";
}
if(file_exists($ROW['image']))
{
$post_image = $image_class->get_thumb_post($ROW['image']);
echo "<img src = '$post_image' style ='width:90%;' align:'center'; />";
}
?>
<hr>
</form>
</div>
<!-- Change profile picture Po-up Ends-->
</div>
</div>
</main>
<!-- JS
============================================ -->
<!-- Modernizer JS -->
<script src="assets/js/vendor/modernizr-3.6.0.min.js"></script>
<!-- jQuery JS -->
<script src="assets/js/vendor/jquery-3.3.1.min.js"></script>
<!-- Popper JS -->
<script src="assets/js/vendor/popper.min.js"></script>
<!-- Bootstrap JS -->
<script src="assets/js/vendor/bootstrap.min.js"></script>
<!-- Slick Slider JS -->
<script src="assets/js/plugins/slick.min.js"></script>
<!-- nice select JS -->
<script src="assets/js/plugins/nice-select.min.js"></script>
<!-- audio video player JS -->
<script src="assets/js/plugins/plyr.min.js"></script>
<!-- perfect scrollbar js -->
<script src="assets/js/plugins/perfect-scrollbar.min.js"></script>
<!-- light gallery js -->
<script src="assets/js/plugins/lightgallery-all.min.js"></script>
<!-- image loaded js -->
<script src="assets/js/plugins/imagesloaded.pkgd.min.js"></script>
<!-- isotope filter js -->
<script src="assets/js/plugins/isotope.pkgd.min.js"></script>
<!-- Main JS -->
<script src="assets/js/main.js"></script>
</body>
</html>