-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist-authors.php
117 lines (109 loc) · 5.71 KB
/
list-authors.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
<?php
require "assets/db.php";
require "assets/varnames.php";
require 'assets/sharedComponents.php';
$components = new SharedComponents();
include 'includes/header.php';
include 'includes/navbar.php';
$stmt = $conn->prepare("SELECT * FROM author WHERE type != 0");
$stmt->execute();
$authors = $stmt->fetchAll();
?>
<!--section-heading-->
<div class="section-heading " >
<div class="container-fluid">
<div class="section-heading-2">
<div class="row">
<div class="col-lg-12">
<div class="section-heading-2-title ">
<h1>All Authors</h1>
<p class="links"><a href="index.php">Home <i class="las la-angle-right"></i></a> pages</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!--blog-layout-1-->
<div class="authors ">
<div class="container-fluid">
<div class="authors-area">
<div class="row">
<input value="<?= $realuserid ?>" id="realuserid" readonly hidden/>
<?php $numcount = 1; foreach ($authors as $author) : $numcount++;?>
<!--author-1-->
<div class="col-md-6 ">
<div class="authors-single">
<div class="authors-single-image">
<a href="author.php?authid=<?= $components->protect($author['author_id']) ?>">
<img src="img/avatar/<?= $author['author_avatar'] ?>" alt="">
</a>
</div>
<div class="authors-single-content ">
<div class="left">
<h6>
<a href="author.php?authid=<?= $components->protect($author['author_id']) ?>"><?= $author['author_fullname'] ?></a>
</h6>
<div class="tags">
<input value="<?=$components->protect($author['author_id']) ?>" id="authorid<?= $numcount?>" readonly hidden/>
<ul class="list-inline">
<li>
<?php if($loggedin == true)
{
$sql = "SELECT * FROM userfollow WHERE user_id = :user_id AND authorid = :authorid";
$stmt = $pdo->prepare($sql);
$stmt->execute(['user_id' => $components->unprotect($realuserid), 'authorid' => $author['author_id']]);
if ($stmt->rowCount() == 1)
{
?>
<a href="javascript:void(0);" onclick="unfollowauthor('#authorid<?= $numcount?>', '#realuserid', <?= $numcount?>);" id='followauth<?= $numcount?>' title="Unfollow">Unfollow</a>
<?php
}
else
{
?>
<a href="javascript:void(0);" onclick="followauthor('#authorid<?= $numcount?>', '#realuserid');" id='followauth' title="Follow Author">Follow</a>
<?php
}
}
else
{
?>
<a href="login.php" title="Follow Author">
Follow
</a>
<?php
}
?>
</li>
</ul>
</div>
<p class="ml-2">
<?php
//get author post total
$authid = $author['author_id'];
$stmt = $conn->prepare("SELECT * FROM `article` WHERE id_author='$authid'");
$stmt->execute();
echo $stmt->rowCount();
?> Post</p>
</div>
<div class="right">
<a href="author.php?authid=<?= $components->protect($author['author_id']) ?>">
<div class="more-icon">
<i class="las la-angle-double-right"></i>
</div>
</a>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
<br>
<?php
include 'includes/footer.php';
include 'includes/scripts.php';
?>