diff options
Diffstat (limited to 'index.php')
-rwxr-xr-x | index.php | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/index.php b/index.php new file mode 100755 index 0000000..a902cce --- /dev/null +++ b/index.php | |||
@@ -0,0 +1,112 @@ | |||
1 | <?php | ||
2 | |||
3 | include('db.php'); | ||
4 | |||
5 | ob_start(); | ||
6 | |||
7 | $posts = array(); | ||
8 | |||
9 | if (isset($_GET['id'])) | ||
10 | { | ||
11 | $getimages = "SELECT * FROM images WHERE id = " . $_GET['id']; | ||
12 | } else { | ||
13 | $getimages = "SELECT * FROM images ORDER BY id DESC LIMIT 0,1"; | ||
14 | } | ||
15 | $getimages2 = mysql_query($getimages); | ||
16 | $getimage3 = mysql_fetch_array($getimages2); | ||
17 | |||
18 | ?> | ||
19 | <DIV CLASS="post"> | ||
20 | <DIV CLASS="date" TITLE="<?php echo(date('F jS Y H:i:s', strtotime($getimage3['pubDate']))); ?>"> | ||
21 | <?php echo(date('M',strtotime($getimage3['pubDate']))); ?><BR> | ||
22 | <?php echo(date('j',strtotime($getimage3['pubDate']))); ?><BR> | ||
23 | <?php echo(date('Y',strtotime($getimage3['pubDate']))); ?> | ||
24 | |||
25 | </DIV> | ||
26 | |||
27 | <DIV CLASS="title"> | ||
28 | <H1><?php echo($getimage3['title']); ?></H1> | ||
29 | </DIV> | ||
30 | </DIV> | ||
31 | |||
32 | <DIV CLASS="image"> | ||
33 | <IMG SRC="/images/<?php echo($getimage3['filename']); ?>" ALT="<?php echo(htmlentities($getimage3['text'])); ?>" TITLE="<?php echo(htmlentities($getimage3['text'])); ?>"> | ||
34 | </DIV> | ||
35 | |||
36 | <DIV CLASS="cleardiv"></DIV> | ||
37 | |||
38 | <UL CLASS="navbar"> | ||
39 | <?php | ||
40 | |||
41 | $id = $getimage3['id']; | ||
42 | $all = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM images")); | ||
43 | $all = $all['COUNT(*)']; | ||
44 | |||
45 | if ($id > 2) | ||
46 | { | ||
47 | ?> <LI><A HREF="/comic1.htm">First</a></LI> | ||
48 | <?php | ||
49 | } | ||
50 | |||
51 | if ($id > 1) | ||
52 | { | ||
53 | ?> <LI><A HREF="/comic<?php echo($id-1); ?>.htm">Back</A></LI> | ||
54 | <?php | ||
55 | } | ||
56 | |||
57 | if ($id < $all) | ||
58 | { | ||
59 | if ($id != ($all-1)) | ||
60 | { | ||
61 | ?> <LI><A HREF="/comic<?php echo($id+1); ?>.htm">Next</A></LI> | ||
62 | <?php | ||
63 | ?> <LI><A HREF="/">Today</A></LI> | ||
64 | <?php | ||
65 | } else { | ||
66 | ?> <LI><A HREF="/">Next</A></LI> | ||
67 | <?php | ||
68 | } | ||
69 | } | ||
70 | |||
71 | $getnpending = "SELECT COUNT(*) FROM pending"; | ||
72 | $getnpending2 = mysql_query($getnpending); | ||
73 | $getnpending3 = mysql_fetch_array($getnpending2); | ||
74 | $numpending = $getnpending3['COUNT(*)']; | ||
75 | |||
76 | ?> | ||
77 | </UL> | ||
78 | |||
79 | <DIV CLASS="cleardiv"></DIV> | ||
80 | |||
81 | <P> | ||
82 | pillowcase - the result of an obsession with cute, plush objects that talk nonsense | ||
83 | </P> | ||
84 | |||
85 | <P> | ||
86 | because we luv <A HREF="http://xkcd.com">xkcd</A>, make sure you look for the alt text | ||
87 | </P> | ||
88 | |||
89 | <P> | ||
90 | <?php if ($numpending == 1): ?> | ||
91 | there is 1 comic in the pending queue, which means that if Starla wants to be lazy and can't be bothered to update, she can relax for 1 more day before she starts getting angry emails | ||
92 | <?php elseif ($numpending == 0): ?> | ||
93 | oh dear, there aren't any comics in the pending queue, which means that if Starla doesn't hurry up, there may not be a comic tomorrow | ||
94 | <?php elseif ($numpending > 100): ?> | ||
95 | OMG! There are <?php echo($numpending); ?> comics in the pending queue! Starla, you relax as long as you want! | ||
96 | <?php else: ?> | ||
97 | there are <?php echo($numpending); ?> comics in the pending queue, which means that if Starla wants to be lazy and can't be bothered to update, she can relax for <?php echo($numpending); ?> days before she starts getting angry emails | ||
98 | <?php endif; ?> | ||
99 | </P> | ||
100 | <?php | ||
101 | |||
102 | $contents = ob_get_contents(); | ||
103 | ob_end_clean(); | ||
104 | |||
105 | $title = $getimage3['title']; | ||
106 | include('header.php'); | ||
107 | |||
108 | echo($contents); | ||
109 | |||
110 | include('footer.php'); | ||
111 | |||
112 | ?> | ||