-
Notifications
You must be signed in to change notification settings - Fork 0
/
lyric.php
492 lines (417 loc) · 26.1 KB
/
lyric.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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
<?php if (!isset($_GET['e-lyrics'])) {
//header("location: index.php");
//exit;
} ?>
<?php
session_start();
include('includes/config.php');
//Genrating CSRF Token
if (empty($_SESSION['token'])) {
$_SESSION['token'] = bin2hex(random_bytes(32));
}
if (isset($_SESSION['comment'])) {
$_POST['comment'] = $_SESSION['comment'];
unset($_SESSION['comment']);
}
if (isset($_POST['comment'])) {
$_SESSION['comment'] = $_POST['comment'];
$_SESSION['cid'] = $_REQUEST['e-lyrics'];
if (!isset($_SESSION['user-login'])) {
$_SESSION['msg'] = "You must log in first";
header('location: users/');
} else {
$username = $_SESSION['user-login'];
$user_check_query = "SELECT * FROM tblusers WHERE username='$username' LIMIT 1";
$res = mysqli_query($con, $user_check_query);
$user = mysqli_fetch_assoc($res);
$userid = $user['id'];
//Verifying CSRF Token
if (!empty($_POST['csrftoken'])) {
if (hash_equals($_SESSION['token'], $_POST['csrftoken'])) {
$comment = $_POST['comment'];
$postid = intval($_GET['e-lyrics']);
$st1 = '0';
$query = mysqli_query($con, "insert into tblcomments(postId,userid,comment,status) values('$postid','$userid','$comment','$st1')");
if ($query) :
echo "<script>alert('comment successfully submit. Comment will be display after admin review ');</script>";
unset($_SESSION['token']);
else :
echo "<script>alert('Something went wrong. Please try again.');</script>";
endif;
}
}
}
}
?>
<?php
if (isset($_GET['e-lyrics'])) {
$id = $_REQUEST['e-lyrics'];
}
else {
$id = '0';
}
$query = "select tbllyrics.likes, tbllyrics.PostTitle as posttitle,tbllyrics.Artist,tblcategory.CategoryName as category,tblcategory.id as cid,tblsubcategory.Subcategory as subcategory,tblsubcategory.SubCategoryId as sid,tbllyrics.PostDetails as postdetails,tbllyrics.PostingDate as postingdate,tbllyrics.PostUrl as url from tbllyrics left join tblcategory on tblcategory.id=tbllyrics.CategoryId left join tblsubcategory on tblsubcategory.SubCategoryId=tbllyrics.SubCategoryId where tbllyrics.PostUrl='$id'";
$result = mysqli_query($con, $query) or die(((is_object($con)) ? mysqli_error($con) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : true)));
$row = mysqli_fetch_assoc($result);
$res = $db_handle->runQuery($query);
//pageview count query
$page = $row['posttitle'];
$count = "SELECT * FROM tblpage_hits WHERE page='" . $page . "'";
$feedback = mysqli_query($con, $count) or die(((is_object($con)) ? mysqli_error($con) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : true)));
$roo = mysqli_fetch_assoc($feedback); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php $title ='E9ja Lyrics Updates'; ?>
<?php include('includes/tag/lyric-tag.php'); ?>
<!-- Title -->
<title>Explicit9ja.com | Song Lyrics</title>
<!-- Favicon -->
<link rel="icon" href="../img/core-img/favicon.ico">
<!-- Stylesheet -->
<link rel="stylesheet" href="style.css">
<link href="like/like.css" rel='stylesheet' type='text/css' />
</head>
<body>
<?php include('includes/share/lyric-share.php'); ?>
<?php include('includes/header.php'); ?>
<!--update database on page views-->
<!--<php require_once('includes/conn.php');-->
<!--require_once('libs/functions.php');-->
<!--$pn = updateCounter('' . $row['posttitle'] . ''); // Updates page hits-->
<!--echo $pn;-->
<!--//updateInfo(); // Updates hit info -->
<!--?>-->
<!-- Lyrics Details Post Thumbnail Area Start -->
<section class="blog-details-post-thumbnail-area bg-overlay bg-img jarallax"
style="background-image: url(img/images/lyrics-poster.png); margin:0,10px,0,0;">
<div class="container h-100">
<div class="row h-100 align-items-center">
<div class="col-12">
<div class="post-title-text">
<h2><?php if (isset($_GET['e-lyrics'])){
echo $row['posttitle']." --- <span style=\"color:red;\">".$row['Artist']."<span>";} else echo "# LYRICS POSTS"; ?></h2>
<div class="post-meta">
<a href="#"><?php echo str_replace(" ", " ... ", $row['postingdate']); ?></a>
<a href="#"><?php if ($id != '0'){echo 'Post by ADMIN'; } ?></a>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- News Details Post Thumbnail Area End -->
<?php if (isset($_GET['e-lyrics'])) {
$id = $_REQUEST['e-lyrics'];
$query = "select tbllyrics.id, tbllyrics.likes, tbllyrics.PostTitle as posttitle,tbllyrics.Artist,tblcategory.CategoryName as category,tblcategory.id as cid,tblsubcategory.Subcategory as subcategory,tblsubcategory.SubCategoryId as sid,tbllyrics.PostDetails as postdetails,tbllyrics.PostingDate as postingdate,tbllyrics.PostUrl as url from tbllyrics left join tblcategory on tblcategory.id=tbllyrics.CategoryId left join tblsubcategory on tblsubcategory.SubCategoryId=tbllyrics.SubCategoryId where tbllyrics.PostUrl='$id'";
$result = mysqli_query($con, $query) or die(((is_object($con)) ? mysqli_error($con) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : true)));
$row = mysqli_fetch_assoc($result);
$res = $db_handle->runQuery($query);
//pageview count query
$page = $row['posttitle'];
$count = "SELECT * FROM tblpage_hits WHERE page='" . $page . "'";
$feedback = mysqli_query($con, $count) or die(((is_object($con)) ? mysqli_error($con) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : true)));
$roo = mysqli_fetch_assoc($feedback); ?>
<!-- News Details Area Start -->
<section class="blog-details-area section-padding-80">
<div class="container">
<!-- Post Details Text -->
<div class="post-details-text">
<div class="row justify-content-center">
<div class="col-12">
<div class="weekly-news-area mb-50">
<div class="section-heading text-center">
<h3># LYRICS POST</h3>
</div>
</div>
</div>
<div class="col-10 col-md-10 col-lg-9">
<?php echo $row['postdetails']; ?>
<!-- Post Catagories -->
<div class="d-flex align-items-center justify-content-between">
<!-- Post Catagories -->
<div class="post-catagories">
<ul class="d-flex flex-wrap align-items-center">
<li><i class="fa fa-tag"></i> Tag: </li>
<li><a
href="tagline-postc?tag=<?php echo htmlentities($row['cid']) ?>"><?php echo htmlentities($row['category']); ?></a>
</li>
<li><a
href="tagline-posts?tag=<?php echo htmlentities($row['sid']) ?>"><?php echo htmlentities($row['subcategory']); ?></a>
</li>
<li><div>
<?php
if(!empty($res)) {
$ip_address = $_SERVER['REMOTE_ADDR'];
?>
<div id="tutorial-<?php echo $res["id"]; ?>">
<input type="hidden" id="likes-<?php echo $res["id"]; ?>" value="<?php echo $res["likes"]; ?>">
<?php
$query ="SELECT * FROM tbllyric_likes_map WHERE lyric_id = '" . $res["id"] . "' and ip_address = '" . $ip_address . "'";
$count = $db_handle->numRows($query);
$page = "lyric";
$str_like = "like";
if(!empty($count)) {
$str_like = "unlike";
}
?>
<div class="btn-likes" style="float:left;"><input type="button" title="<?php echo ucwords($str_like); ?>" class="<?php echo $str_like; ?> " onClick="addLikes(<?php echo $res["id"]; ?>,'<?php echo $str_like; ?>', '<?php echo $page; ?>')" /></div>
<div class="label-likes" style="float:right; margin-top:3px;"><?php if(!empty($res["likes"])) { echo $res["likes"] . " Like(s)"; } else{echo "No Likes on this post yet";} ?></div>
</div>
<?php } ?>
</div>
</li>
</ul>
</div>
</div>
<!-- Post Share -->
<div class="social-btns">
<h4 class="h">Share this lyrics:</h4>
<a href="<?php echo socialshare('facebook', $params); ?>" target="blank" class="social-margin">
<div class="social-icon facebook-icon">
<i class="fa fa-facebook" aria-hidden="true"></i>
</div>
</a>
<a href="<?php echo socialshare('pinterest', $params); ?>" target="blank" class="social-margin">
<div class="social-icon pinterest-icon">
<i class="fa fa-pinterest" aria-hidden="true"></i>
</div>
</a>
<a href="<?php echo socialshare('linkedin', $params); ?>" class="social-margin" target="blank">
<div class="social-icon linkedin-icon">
<i class="fa fa-linkedin" aria-hidden="true"></i>
</div>
</a>
<a href="<?php echo socialshare('whatsapp', $params); ?>" target="blank" class="social-margin">
<div class="social-icon whatsapp-icon">
<i class="fa fa-whatsapp" aria-hidden="true"></i>
</div>
</a>
<a href="<?php echo socialshare('tumblr', $params); ?>" target="blank" class="social-margin">
<div class="social-icon tumblr-icon">
<i class="fa fa-tumblr" aria-hidden="true"></i>
</div>
</a>
<a href="<?php echo socialshare('telegram', $params); ?>" target="blank" class="social-margin">
<div class="social-icon telegram-icon">
<i class="fa fa-telegram" aria-hidden="true"></i>
</div>
</a>
<a href="<?php echo socialshare('skype', $params); ?>" target="blank" class="social-margin">
<div class="social-icon skype-icon">
<i class="fa fa-skype" aria-hidden="true"></i>
</div>
</a>
<a href="<?php echo socialshare('twitter', $params); ?>" target="blank" class="social-margin">
<div class="social-icon twitter-icon">
<i class="fa fa-twitter" aria-hidden="true"></i>
</div>
</a>
</div>
<!--post share end-->
<!-- Comments Area -->
<div class="comment_area mb-50 clearfix">
<h5 class="title">
<?php $sts = 1;
$result = mysqli_query($con, "select * from tblcomments where postId='$id' and status='$sts'");
$total_rows = mysqli_num_rows($result);
if ($total_rows == 0) {
echo 'No Comments on this post yet';
} else if ($total_rows == 1) {
echo $total_rows . ' Comment';
} else {
echo $total_rows . ' Comments';
} ?>
</h5>
<ol>
<!-- Single Comment Area -->
<?php
if (isset($_SESSION['user-login'])) {
$username = $_SESSION['user-login'];
$user_check_query = "SELECT * FROM tblusers WHERE username='$username' LIMIT 1";
$res = mysqli_query($con, $user_check_query);
$user = mysqli_fetch_array($res);
$userid = $user['id'];
echo $userid;
}
?>
<?php
$sts = 1;
$query = mysqli_query($con, "select id,postId,userid,comment,postingDate from tblcomments where postId='$id' and status='$sts'");
while ($row = mysqli_fetch_array($query)) {
$userid = $row['userid'];
$user_check_query = "SELECT * FROM tblusers WHERE id='$userid'";
$res = mysqli_query($con, $user_check_query);
$user = mysqli_fetch_array($res);
$name = $user['username'];
$email = $user['email'];
$com_id = $row['id'];
$type = -1;
// Checking user status
$status_query = "SELECT count(*) as cntStatus,type FROM tblcomment_likes WHERE userid=" . $userid . " and commentid=" . $com_id;
$status_result = mysqli_query($con, $status_query);
$status_row = mysqli_fetch_array($status_result);
$count_status = $status_row['cntStatus'];
if ($count_status > 0) {
$type = $status_row['type'];
}
// Count post total likes and unlikes
$like_query = "SELECT COUNT(*) AS cntLikes FROM tblcomment_likes WHERE type=1 and commentid=" . $com_id;
$like_result = mysqli_query($con, $like_query);
$like_row = mysqli_fetch_array($like_result);
$total_likes = $like_row['cntLikes'];
$unlike_query = "SELECT COUNT(*) AS cntUnlikes FROM tblcomment_likes WHERE type=0 and commentid=" . $com_id;
$unlike_result = mysqli_query($con, $unlike_query);
$unlike_row = mysqli_fetch_array($unlike_result);
$total_unlikes = $unlike_row['cntUnlikes'];
?>
<li class="single_comment_area">
<!-- Comment Content -->
<div class="comment-content d-flex">
<!-- Comment Author -->
<div class="comment-author">
<img src="img/bg-img/15.jpg" alt="author">
</div>
<!-- Comment Meta -->
<div class="comment-meta">
<a href="#"
class="author-name"><?php $result = mysqli_query($con, "select * from tblusers where id='$userid'");
$user = mysqli_fetch_array($result);
echo htmlentities($user['username']); ?>
<span class="post-date"> #
<?php echo htmlentities($row['postingDate']); ?></span></a>
<p><?php echo htmlentities($row['comment']); ?> </p>
<input type="button" value="Like" id="like_<?php echo $com_id; ?>"
class="like"
style="<?php if ($type == 1) {
echo "color: #dc2878;";
} ?>" /><b> (<span
id="likes_<?php echo $com_id; ?>"><?php echo $total_likes; ?></span>) </b>
<input type="button" value="Unlike" id="unlike_<?php echo $com_id; ?>"
class="unlike"
style="<?php if ($type == 0) {
echo "color: #dc2878;";
} ?>" /><b> (<span
id="unlikes_<?php echo $com_id; ?>"><?php echo $total_unlikes; ?></span>)
</b>
</div>
</div>
<!--<ol class="children">
<li class="single_comment_area"> -->
<!-- Comment Content -->
<!-- <div class="comment-content d-flex"> -->
<!-- Comment Author -->
<!-- <div class="comment-author">
<img src="img/bg-img/16.jpg" alt="author">
</div> -->
<!-- Comment Meta -->
<!--<div class="comment-meta">
<a href="#" class="author-name">Milley Cyrus <span class="post-date">- May 20, 2018</span></a>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
<a href="#" class="like">Like</a>
<a href="#" class="reply">Reply</a>
</div>
</div>
</li>
</ol> -->
</li>
<?php } ?>
</ol>
</div>
<!-- Leave A Reply -->
<div class="razo-contact-form">
<h2 class="mb-4">Leave A Comment On Lyrics Post</h2>
<!-- Form -->
<form name="Comment" method="post">
<input type="hidden" name="csrftoken"
value="<?php echo htmlentities($_SESSION['token']); ?>" />
<div class="row">
<div class="col-lg-6">
<input type="text" name="name" class="form-control mb-30"
placeholder="Full Name" required>
</div>
<div class="col-lg-6">
<input type="email" name="email" class="form-control mb-30"
placeholder="Valid Email" required>
</div>
<div class="col-12">
<textarea name="comment" class="form-control mb-30" placeholder="Comment"
required></textarea>
</div>
<div class="col-12">
<button type="submit" name="comment-submit"
class="btn razo-btn btn-3 mt-15">Post Comment</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- News Details Area End -->
<?php } ?>
<!-- Related News Area Start -->
<section class="razo-blog-area section-padding-80-0">
<div class="container">
<div class="row">
<!-- Section Heading -->
<div class="col-12">
<div class="weekly-news-area mb-50">
<div class="section-heading text-center">
<h2><?php if (isset($_GET['e-lyrics'])){
echo "RELATED LYRICS POST";} else echo "LATEST LYRICS"; ?></h2>
</div>
</div>
</div>
</div>
<!-- Blog Post -->
<?php
if (isset($_GET['pageno'])) {
$pageno = $_GET['pageno'];
} else {
$pageno = 1;
}
$no_of_records_per_page = 8;
$offset = ($pageno-1) * $no_of_records_per_page;
$total_pages_sql = "SELECT COUNT(*) FROM tbllyrics";
$result = mysqli_query($con,$total_pages_sql);
$total_rows = mysqli_fetch_array($result, MYSQLI_NUM)[0];
$total_pages = ceil($total_rows / $no_of_records_per_page);
require_once('libs/functions.php');
$query=mysqli_query($con,"select tbllyrics.id as pid,tbllyrics.PostTitle as posttitle,tbllyrics.Artist,tblcategory.CategoryName as category,tblcategory.id as cid,tblsubcategory.Subcategory as subcategory,tbllyrics.PostDetails as postdetails,tbllyrics.PostingDate as postingdate,tbllyrics.PostUrl as url from tbllyrics left join tblcategory on tblcategory.id=tbllyrics.CategoryId left join tblsubcategory on tblsubcategory.SubCategoryId=tbllyrics.SubCategoryId where tbllyrics.Is_Active=1 order by tbllyrics.id desc LIMIT $offset, $no_of_records_per_page");
while ($row=mysqli_fetch_array($query, MYSQLI_ASSOC)) {
?>
<div class="col-12 col-md-12">
<!-- Single Post Area -->
<div class="razo-single-post d-flex mb-30">
<!-- Post Thumbnail -->
<div class="post-thumbnail">
<a href="lyric?e-lyrics=<?php echo $row['url'];?>"><img style="height:70px; width:140px;" src="img/images/lyrics-thumb.jpg" alt="<?php echo $row['posttitle'];?>"></a>
</div>
<!-- Post Content -->
<div class="post-content">
<div class="post-meta">
</div>
<a href="lyric?e-lyrics=<?php echo $row['url'];?>" class="post-title"><?php echo $row['posttitle'];?></a>
</div>
</div>
<!--<span><hr></span>-->
</div>
<?php } ?>
</div>
<!-- Pagination -->
<ul class="pagination justify-content-center mb-4">
<li class="page-item"><a href="?pageno=1" class="page-link">First</a></li>
<li class="<?php if($pageno <= 1){ echo 'disabled'; } ?> page-item">
<a href="<?php if($pageno <= 1){ echo '#'; } else { echo "?pageno=".($pageno - 1); } ?>" class="page-link">Prev</a>
</li>
<li class="<?php if($pageno >= $total_pages){ echo 'disabled'; } ?> page-item">
<a href="<?php if($pageno >= $total_pages){ echo '#'; } else { echo "?pageno=".($pageno + 1); } ?> " class="page-link">Next</a>
</li>
<li class="page-item"><a href="?pageno=<?php echo $total_pages; ?>" class="page-link">Last</a></li>
</ul>
<?php include('includes/footer.php'); ?>
</body>
</html>