-
Notifications
You must be signed in to change notification settings - Fork 0
/
posts.php
370 lines (296 loc) · 12.2 KB
/
posts.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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<title>Help</title>
<!-- Main CSS -->
<link rel="stylesheet" href="assets/css/style_m.css">
<script src="jq.js"></script>
<script src="hayageek.js"></script>
<link href="assets/css/upload.css" rel="stylesheet">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="admin/assets/img/favicon.png">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="admin/assets/css/bootstrap.min.css">
<!-- Fontawesome CSS -->
<link rel="stylesheet" href="admin/assets/css/font-awesome.min.css">
<!-- Feathericon CSS -->
<link rel="stylesheet" href="admin/assets/css/feathericon.min.css">
<!-- Datatables CSS -->
<link rel="stylesheet" href="admin/assets/plugins/datatables/datatables.min.css">
<!-- Main CSS -->
<link rel="stylesheet" href="assets/css/style.css">
<link href="assets/img/favicon.png" rel="icon">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<!-- Fontawesome CSS -->
<link rel="stylesheet" href="assets/plugins/fontawesome/css/fontawesome.min.css">
<link rel="stylesheet" href="assets/plugins/fontawesome/css/all.min.css">
<!-- Datetimepicker CSS -->
<link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css">
<!-- Select2 CSS -->
<link rel="stylesheet" href="assets/plugins/select2/css/select2.min.css">
<!-- Fancybox CSS -->
<link rel="stylesheet" href="assets/plugins/fancybox/jquery.fancybox.min.css">
<link href="assets/img/favicon.png" rel="icon">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<!-- Fontawesome CSS -->
<link rel="stylesheet" href="assets/plugins/fontawesome/css/fontawesome.min.css">
<link rel="stylesheet" href="assets/plugins/fontawesome/css/all.min.css">
<!-- Main CSS -->
<link rel="stylesheet" href="assets/css/style.css">
<style>
body {
background-color: #fff;
}
.time {
font-size: 9px !important
}
.socials i {
margin-right: 14px;
font-size: 17px;
color: #161515;
cursor: pointer
}
.feed-image img {
width: 100%;
height: auto
}
</style>
<!--[if lt IE 9]>
<script src="assets/js/html5shiv.min.js"></script>
<script src="assets/js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Main Wrapper -->
<!--//////////////////////////-->
<!-- Header -->
<?php include 'head_res.php';
include 'db.php';?>
<?php
if(isset($_POST['name']))
{
$id=$_REQUEST['pid'];
$name=mysqli_real_escape_string($con,$_REQUEST['name']);
$title=mysqli_real_escape_string($con, $_REQUEST['title']);
$des=mysqli_real_escape_string($con, $_REQUEST['des']);
$addres=mysqli_real_escape_string($con,$_REQUEST['address']);
$phno=$_REQUEST['phone'];
$post_q="INSERT INTO `posts`(`post_id`, `name`, `title`, `adderss`, `des`, `phone`, `date`) VALUES ('$id','$name','$title','$addres','$des','$phno',now())";
$msg="
[".$title."]
Name : ".$name."
Problem : ".$des."
Addres : ".$addres."
Phone : ".$phno."
Link : https://msivaji.in/twf/get_post.php?id=".$id."
";
//$url="https://api.telegram.org/bot1836503539:AAHMPJVUkVG_p4iA08pDDtBu8szny2cjHYg/sendMessage?chat_id=-571558132&text=".urlencode($msg);
//$tres=file_get_contents($url,false,stream_context_create($arrContextOptions));
$post_res=mysqli_query($con,$post_q);
if($post_res)
{
echo '<script>
function loadXMLDoc() {
var msg="'.urlencode($msg).'";
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var obj = JSON.parse(this.responseText);
}
};
xhttp.open("GET", "https://api.telegram.org/bot1836503539:AAHMPJVUkVG_p4iA08pDDtBu8szny2cjHYg/sendMessage?chat_id=-571558132&text="+msg+"", true);
xhttp.send();
}
loadXMLDoc();
</script>';
echo '<script>alert("Posted Sucessfully")</script>';
}
else{
echo '<script>alert("Error While Posting...'.mysqli_error($con).' ")</script>';
}
}
?>
<div class="row">
<div class="col-md-2 col-lg-2 col-sm-0 col-0 d-none d-sm-none d-md-inline d-lg-inline" style="height: 80vh;">
<div class="d-sm-none d-md-inline d-lg-inline">
<img src="icons/gig3.gif" class="ml-3 d-none d-sm-none d-md-inline d-lg-inline" width="150%" height="600px">
</div>
</div>
<div class="col-md-12 col-lg-10 col-sm-12 col-12 overflow-auto" style="height: 300vh;">
<div class="container mb-3 float-left" >
<div class="d-flex justify-content-center row">
<div class="col-md-10" >
<div class="feed p-2">
<div class="bg-white mt-2 shadow ">
<div>
<div class="d-flex flex-row justify-content-between align-items-center p-2">
<div class="d-flex flex-row feed-text px-2"><img class="rounded-circle" src="assets/def.png" width="45">
<div class="d-flex flex-column text-center flex-wrap ml-2"><h3 class="font-weight-bold">Add Post For Help</h3></div>
</div>
</div>
</div>
<div class="p-4 px-3 d-flex flex-row-reverse">
<button type="button" class="btn btn-primary" style="background-color:#009688 !important;" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo">Create Post</button>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Create Posts</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="" method="post" >
<div class="card card-primary">
<input type="hidden" id="pid" name="pid" value="<?php echo md5(time().date('ymd')); ?>">
<!-- /.card-header -->
<!-- form start -->
<div class="card-body">
<div class="form-group">
<label for="exampleInputEmail1">Name</label>
<input type="text" name="name" class="form-control" id="exampleInputEmail1" placeholder=" Name">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Title</label>
<input type="text" name="title" class="form-control" id="exampleInputEmail1" placeholder="Title">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Address</label>
<input type="text" name="address" class="form-control" id="exampleInputEmail1" placeholder="Address">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Description of Post</label>
<textarea type="text" name="des" class="form-control" id="exampleInputEmail1"></textarea>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Phone number</label>
<input type="number" name="phone" class="form-control" id="exampleInputPassword1" placeholder="Phone number">
</div>
<div class="form-group">
<label for="exampleInputFile">Upload Post Attachment</label>
<div class="" id="fileuploader" ></div>
</div>
<div class="form-group">
<label for="exampleInputFile">Upload Profile Photo</label>
<div class="" id="fileuploader2" ></div>
</div>
</div>
<!-- /.card-body -->
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<input type="submit" value="Send message" class="btn btn-primary">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
$q="SELECT * FROM posts ORDER BY date desc";
$res=mysqli_query($con,$q);
while($row=mysqli_fetch_array($res))
{
?>
<div class="container mt-3 mb-3 float-left">
<div class="d-flex justify-content-center row">
<div class="col-md-9">
<div class="feed p-2 shadow ">
<div class="bg-white mt-2" style="border-radius:5px 5px 5px 5px;">
<div>
<div class="d-flex flex-row justify-content-between align-items-center p-2 border-bottom">
<div class="d-flex flex-row align-items-center feed-text px-2"><img class="rounded-circle" src="assets/user_profile_pic/postp_<?php echo $row['post_id'].'.jpg'; ?>" width="45" onerror="this.onerror=null;this.src='assets/def.png';">
<div class="d-flex flex-column flex-wrap ml-2"><span class="font-weight-bold"><?php echo $row['name']; ?></span><span class="text-black-50"><?php echo $row['adderss']; ?></span></div>
</div>
<div class="feed-icon px-2">
<i class="fa fa-ellipsis-v text-black-50 float-right mt-2"></i><br>
<?php echo tago(strtotime( $row['date'])); ?></div>
</div>
</div>
<div class="p-2 px-3">
<h3><?php echo $row['title']; ?></h3>
<br>
<span><?php echo $row['des']; ?></span>
</div>
<div class="bg-white">
<div>
<button onclick="show_post('<?php echo $row['post_id']; ?>')" class="btn btn-control bg-white text-white ml-5 mt-4 mb-4"><img style="width:100px;height:100px" src="assets/user_profile_pic/post_<?php echo $row['post_id'].'.jpg'; ?>" onerror="this.onerror=null;this.src='assets/post.png';this.style.display = 'none';"></img></button>
<div class="float-right socials p-2 py-3">
<i class="fa fa-thumbs-up"></i>
<i class="fa fa-comments-o"></i>
<i class="fa fa-share"></i></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php include 'footer.php'; ?>
<!-- Bootstrap Core JS -->
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<!-- Slick JS -->
<script src="assets/js/slick.js"></script>
<!-- Custom JS -->
<script src="assets/js/script.js"></script>
<?php echo'
<script>
$(document).ready(function()
{
var id=document.getElementById("pid").value;
var uploadObj=$("#fileuploader").uploadFile({
url:"file_upload.php",
fileName:"myfile",
maxFileCount:1,
multiple:false,
acceptFiles:"image/*",
showDone:false,
formData: {"filename_id":'."'post_'+id".'},
afterUploadAll:function(obj)
{
alert("Document Uploaded..");
}
});
});
$(document).ready(function()
{
var id=document.getElementById("pid").value;
var uploadObj=$("#fileuploader2").uploadFile({
url:"file_upload.php",
fileName:"myfile",
maxFileCount:1,
multiple:false,
acceptFiles:"image/*",
showDone:false,
formData: {"filename_id":'."'postp_'+id".'},
afterUploadAll:function(obj)
{
alert("Profile Photo Uploaded..");
}
});
});
</script>';
?>
<script>
function show_post(id) {
var url="assets/user_profile_pic/post_"+id+".jpg";
window.open(url, "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=100,left=1000,width=400,height=400");
}
</script>
</body>
</html> <!-- /Header -->