summary refs log tree commit diff stats
path: root/pages/comic.php
blob: 53b0538f1f2f320e97f78c55aaf61af0d82dd8aa (plain) (blame)
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
<?php

if (isset($_GET['id']) && is_numeric($_GET['id']))
{
  $getcomic = $mysql_conn->prepare("SELECT * FROM comics WHERE comic_id = ? AND status = \"publish\"");
  $comic_id = $_GET['id'];
  $getcomic->bind_param("i", $comic_id);
  $getcomic->execute();
  $getcomic2 = $getcomic->get_result();
  $getcomic3 = $getcomic2->fetch_assoc();
} else {
  $getcomic = $mysql_conn->query("SELECT * FROM comics WHERE status = \"publish\" ORDER BY comic_id DESC LIMIT 0,1");
  $getcomic3 = $getcomic->fetch_assoc();
}

$date = strtotime(get_meta($getcomic3['id'], 'pubDate'));

?>
			<DIV CLASS="post">
				<DIV CLASS="date" TITLE="<?php echo(date('F jS Y g:i a', $date)); ?>">
					<?php echo(date('M', $date)); ?><BR>
					<?php echo(date('j', $date)); ?><BR>
					<?php echo(date('Y', $date)); ?>

				</DIV>

				<DIV CLASS="title">
					<H2><?php echo($getcomic3['title']); ?></H2>
<?php

if (has_meta($getcomic3['id'], 'author'))
{
?>
					<CENTER><SMALL>Guest comic by <?php echo(get_meta($getcomic3['id'], 'author')); ?></SMALL></CENTER>
<?php
}

?>
				</DIV>
			</DIV>

			<DIV CLASS="image">
<?php

if (has_meta($getcomic3['id'], 'link'))
{
?>
				<A HREF="<?php echo(get_meta($getcomic3['id'], 'link')); ?>">
	<?php
}
?>
				<IMG SRC="/images/comics/<?php echo($getcomic3['filename']); ?>" ALT="<?php echo(htmlentities($getcomic3['text'])); ?>" TITLE="<?php echo(htmlentities($getcomic3['text'])); ?>">
<?php

if (has_meta($getcomic3['id'], 'link'))
{
?>
				</A>
<?php
}
?>
			</DIV>

			<DIV CLASS="cleardiv"></DIV>

			<UL CLASS="navbar">
<?php

$id = $getcomic3['comic_id'];

$cntcomics = $mysql_conn->query("SELECT COUNT(*) FROM comics WHERE status = \"publish\"");
$cntcomics3 = $cntcomics->fetch_assoc();
$all = $cntcomics3['COUNT(*)'];

if ($id > 2)
{
?>				<LI><A HREF="/comic1.htm">First</a></LI>
<?php
}

if ($id > 1)
{
?>				<LI><A HREF="/comic<?php echo($id-1); ?>.htm">Back</A></LI>
<?php
}

?>				<LI><A HREF="/random.htm">Random</A></LI>
<?php

if ($id < $all)
{
	if ($id != ($all-1))
	{
?>				<LI><A HREF="/comic<?php echo($id+1); ?>.htm">Next</A></LI>
<?php
?>				<LI><A HREF="/">Today</A></LI>
<?php
	} else {
?>				<LI><A HREF="/">Next</A></LI>
<?php
	}
}

$cntpending = $mysql_conn->query("SELECT COUNT(*) FROM comics WHERE status = \"pending\"");
$cntpending3 = $cntpending->fetch_assoc();
$numpending = $cntpending3['COUNT(*)'];

?>
			</UL>

			<DIV CLASS="cleardiv"></DIV>
<?php

if (has_meta($getcomic3['id'], 'text'))
{
?>
			<P>
				<?php echo(get_meta($getcomic3['id'], 'text')); ?>
			</P>
<?php

}
?>

			<P>
				pillowcase - the result of an obsession with cute, plush objects that talk nonsense
			</P>

			<P>
				because we luv <A HREF="http://xkcd.com">xkcd</A>, make sure you look for the alt text
			</P>

			<P>
<?php if ($numpending == 1): ?>
				there is 1 comic in the pending queue, which means that if Hatkirby wants to be lazy and can't be bothered to update, he can relax for 1 more day before he starts getting angry emails
<?php elseif ($numpending == 0): ?>
				oh dear, there aren't any comics in the pending queue, which means that if Hatkirby doesn't hurry up, there may not be a comic tomorrow
<?php elseif ($numpending > 100): ?>
				OMG! There are <?php echo($numpending); ?> comics in the pending queue! Hatkirby, you relax as long as you want!
<?php else: ?>
				there are <?php echo($numpending); ?> comics in the pending queue, which means that if Hatkirby wants to be lazy and can't be bothered to update, he can relax for <?php echo($numpending); ?> days before he starts getting angry emails
<?php endif; ?>
			</P>
<?php

$title = $getcomic3['title'];

?>