-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthor.php
More file actions
47 lines (44 loc) · 932 Bytes
/
author.php
File metadata and controls
47 lines (44 loc) · 932 Bytes
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
<?php
require_once('functions.php');
connect();
if(!isset($_GET['name'])){
$list = true;
}else{
$list = false;
$posts = view_authors($_GET['name']);
}
?>
<!doctype html>
<html>
<head>
<title>
<?php echo ($list) ? 'Authors' : 'Author: ' . $_GET['name']; ?>
</title>
<?php
head();
if($list){
echo " <h2>All authors</h2>\n";
$name_array = list_names();
if($name_array != 0){
echo " <ul class=\"list\">\n";
foreach($name_array as $name){
echo ' <li><a href="author.php?name=' . $name . '">' . word_wrap($name) . "</a></li>\n";
}
echo " </ul>\n";
}else{
echo "<p class=\"error\">Failed :(</p>";
}
}else{
?>
<h2>Posts by <?php echo $_GET['name']; ?></h2>
<?php
if($posts != 0){
echo $posts;
}else{
echo "<p class=\"error\">Failed :(</p>";
}
}
footer();
?>
</body>
</html>