diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2009-02-22 13:15:37 -0500 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2009-02-22 13:15:37 -0500 |
| commit | eee98526c48b9154cd9e9bc8bc3e07769e6a39ea (patch) | |
| tree | 9d8d719a2ccea91de86435ccd985241ddb3fa0cb /index.php | |
| parent | 653c7b3a488488d4b161a8fae41ada5851bf7685 (diff) | |
| download | pillowcase-eee98526c48b9154cd9e9bc8bc3e07769e6a39ea.tar.gz pillowcase-eee98526c48b9154cd9e9bc8bc3e07769e6a39ea.tar.bz2 pillowcase-eee98526c48b9154cd9e9bc8bc3e07769e6a39ea.zip | |
Rewrote Pillowcase
NOTE: There is a new database schema now, so the database from the testing server has to be copied over to the production server, otherwise this code will fail.
Diffstat (limited to 'index.php')
| -rw-r--r--[-rwxr-xr-x] | index.php | 119 |
1 files changed, 10 insertions, 109 deletions
| diff --git a/index.php b/index.php index d1178a0..3738020 100755..100644 --- a/index.php +++ b/index.php | |||
| @@ -1,123 +1,24 @@ | |||
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | include('db.php'); | 3 | include('includes/db.php'); |
| 4 | include('includes/functions.php'); | ||
| 4 | 5 | ||
| 5 | ob_start(); | 6 | ob_start(); |
| 6 | 7 | ||
| 7 | if (isset($_GET['id'])) | 8 | $filename = 'pages/' . basename($_GET['area']) . '.php'; |
| 9 | if (!file_exists($filename)) | ||
| 8 | { | 10 | { |
| 9 | $getimage = "SELECT * FROM images WHERE id = " . $_GET['id']; | 11 | $filename = 'pages/comic.php'; |
| 10 | } else { | ||
| 11 | $getimage = "SELECT * FROM images ORDER BY id DESC LIMIT 0,1"; | ||
| 12 | } | 12 | } |
| 13 | $getimage2 = mysql_query($getimage); | ||
| 14 | $getimage3 = mysql_fetch_array($getimage2); | ||
| 15 | 13 | ||
| 16 | ?> | 14 | include($filename); |
| 17 | <DIV CLASS="post"> | ||
| 18 | <DIV CLASS="date" TITLE="<?php echo(date('F jS Y g:i a', strtotime($getimage3['pubDate']))); ?>"> | ||
| 19 | <?php echo(date('M',strtotime($getimage3['pubDate']))); ?><BR> | ||
| 20 | <?php echo(date('j',strtotime($getimage3['pubDate']))); ?><BR> | ||
| 21 | <?php echo(date('Y',strtotime($getimage3['pubDate']))); ?> | ||
| 22 | |||
| 23 | </DIV> | ||
| 24 | |||
| 25 | <DIV CLASS="title"> | ||
| 26 | <H2><?php echo($getimage3['title']); ?></H2> | ||
| 27 | <?php | ||
| 28 | |||
| 29 | if ($getimage3['author'] != '') | ||
| 30 | { | ||
| 31 | ?> | ||
| 32 | <CENTER><SMALL>Guest comic by <?php echo($getimage3['author']); ?></SMALL></CENTER> | ||
| 33 | <?php | ||
| 34 | } | ||
| 35 | |||
| 36 | ?> | ||
| 37 | </DIV> | ||
| 38 | </DIV> | ||
| 39 | |||
| 40 | <DIV CLASS="image"> | ||
| 41 | <IMG SRC="/images/<?php echo($getimage3['filename']); ?>" ALT="<?php echo(htmlentities($getimage3['text'])); ?>" TITLE="<?php echo(htmlentities($getimage3['text'])); ?>"> | ||
| 42 | </DIV> | ||
| 43 | |||
| 44 | <DIV CLASS="cleardiv"></DIV> | ||
| 45 | |||
| 46 | <UL CLASS="navbar"> | ||
| 47 | <?php | ||
| 48 | |||
| 49 | $id = $getimage3['id']; | ||
| 50 | |||
| 51 | $cntimages = "SELECT COUNT(*) FROM images"; | ||
| 52 | $cntimages2 = mysql_query($cntimages); | ||
| 53 | $cntimages3 = mysql_fetch_array($cntimages2); | ||
| 54 | $all = $cntimages3['COUNT(*)']; | ||
| 55 | |||
| 56 | if ($id > 2) | ||
| 57 | { | ||
| 58 | ?> <LI><A HREF="/comic1.htm">First</a></LI> | ||
| 59 | <?php | ||
| 60 | } | ||
| 61 | |||
| 62 | if ($id > 1) | ||
| 63 | { | ||
| 64 | ?> <LI><A HREF="/comic<?php echo($id-1); ?>.htm">Back</A></LI> | ||
| 65 | <?php | ||
| 66 | } | ||
| 67 | |||
| 68 | if ($id < $all) | ||
| 69 | { | ||
| 70 | if ($id != ($all-1)) | ||
| 71 | { | ||
| 72 | ?> <LI><A HREF="/comic<?php echo($id+1); ?>.htm">Next</A></LI> | ||
| 73 | <?php | ||
| 74 | ?> <LI><A HREF="/">Today</A></LI> | ||
| 75 | <?php | ||
| 76 | } else { | ||
| 77 | ?> <LI><A HREF="/">Next</A></LI> | ||
| 78 | <?php | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | $cntpending = "SELECT COUNT(*) FROM pending"; | ||
| 83 | $cntpending2 = mysql_query($cntpending); | ||
| 84 | $cntpending3 = mysql_fetch_array($cntpending2); | ||
| 85 | $numpending = $cntpending3['COUNT(*)']; | ||
| 86 | |||
| 87 | ?> | ||
| 88 | </UL> | ||
| 89 | |||
| 90 | <DIV CLASS="cleardiv"></DIV> | ||
| 91 | 15 | ||
| 92 | <P> | 16 | $doc = ob_get_contents(); |
| 93 | pillowcase - the result of an obsession with cute, plush objects that talk nonsense | ||
| 94 | </P> | ||
| 95 | 17 | ||
| 96 | <P> | ||
| 97 | because we luv <A HREF="http://xkcd.com">xkcd</A>, make sure you look for the alt text | ||
| 98 | </P> | ||
| 99 | |||
| 100 | <P> | ||
| 101 | <?php if ($numpending == 1): ?> | ||
| 102 | 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 | ||
| 103 | <?php elseif ($numpending == 0): ?> | ||
| 104 | 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 | ||
| 105 | <?php elseif ($numpending > 100): ?> | ||
| 106 | OMG! There are <?php echo($numpending); ?> comics in the pending queue! Starla, you relax as long as you want! | ||
| 107 | <?php else: ?> | ||
| 108 | 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 | ||
| 109 | <?php endif; ?> | ||
| 110 | </P> | ||
| 111 | <?php | ||
| 112 | |||
| 113 | $contents = ob_get_contents(); | ||
| 114 | ob_end_clean(); | 18 | ob_end_clean(); |
| 115 | 19 | ||
| 116 | $title = $getimage3['title']; | 20 | include('includes/header.php'); |
| 117 | include('header.php'); | 21 | echo($doc); |
| 118 | 22 | include('includes/footer.php'); | |
| 119 | echo($contents); | ||
| 120 | |||
| 121 | include('footer.php'); | ||
| 122 | 23 | ||
| 123 | ?> | 24 | ?> |
