archive.php
77 lines
| 2.6 KiB
| text/x-php
|
XmlPhpLexer
| r2 | <?php | |||
| include('frontend.inc.php'); | ||||
| $TYPES = mysqli_query($link,'SELECT DISTINCT strip_t.id, strip_t.description, strip_t.name, meta.meta FROM strip_t | ||||
| LEFT JOIN meta ON strip_t.id = meta.type | ||||
| ORDER BY meta.meta, strip_t.id') or die(mysqli_error($link)); | ||||
| #$MTIME = mysqli_query($link,'SELECT UNIX_TIMESTAMP(MAX(published)) FROM strip') or die(mysqli_error($link)); | ||||
| #conditional_exit(current(mysqli_fetch_row($MTIME))); | ||||
| pagehead('archive', 'Archives'); | ||||
| ?> | ||||
| <div class="content"> | ||||
| <h2>View By:</h2> | ||||
| <div><ul class="nl"> | ||||
| <li><a href="archive.php?list_by=date">View by Date</a></li> | ||||
| <li><a href="archive.php">View by Section</a></li> | ||||
| <li><a href="archive.php?list_by=date">View in Order</a></li> | ||||
| </ul></div> | ||||
| </div> | ||||
| <?php | ||||
| if(isset($_REQUEST['list_by']) && $_REQUEST['list_by'] == "date") | ||||
| { | ||||
| $comics = mysqli_query($link,"SELECT distinct id, title, | ||||
| DATE_FORMAT(published, '%M %D, %Y') AS pubdate | ||||
| FROM strip WHERE published < NOW() ORDER BY id") or die(mysqli_error($link)); | ||||
| r36 | ||||
| r2 | echo '<div class="content"><h2>Comics by Date</h2><div><ul>'; | |||
| while($comic = mysqli_fetch_assoc($comics)) | ||||
| printf('<li><a title="%s" name="%d" href="./strip/%d">%04d - %s</a></li>', $comic['pubdate'], $comic['id'], $comic['id'], $comic['id'], htmlentities($comic['title'])); | ||||
| echo '</ul></div></div>'; | ||||
| } | ||||
| #elseif(!isset($_REQUEST['list_by']) || $_REQUEST['list_by'] == "type") | ||||
| else | ||||
| { | ||||
| ?> | ||||
| <div class="content" id="typelinks"> | ||||
| <h2>Comics by Section</h2> | ||||
| <div><ul><?php | ||||
| while ($type = mysqli_fetch_assoc($TYPES)) { | ||||
| $comics = mysqli_query($link,"SELECT distinct id, title FROM strip WHERE type = $type[id] AND published < NOW()") or die(mysqli_error($link)); | ||||
| if (mysqli_num_rows($comics) <= 0) | ||||
| continue; | ||||
| echo "\t\t<li><a href=\"archive.php#$type[name]\">", htmlentities($type[description]), "</a></li>\n"; | ||||
| } | ||||
| ?></ul></div> | ||||
| </div> | ||||
| <?php | ||||
| mysqli_data_seek($TYPES, 0); | ||||
| while($type = mysqli_fetch_assoc($TYPES)) { | ||||
| $comics = mysqli_query($link,"SELECT distinct id, title, | ||||
| DATE_FORMAT(published, '%M %D, %Y') AS pubdate | ||||
| FROM strip WHERE type = $type[id] AND published < NOW()") or die(mysqli_error($link)); | ||||
| if(mysqli_num_rows($comics) <= 0) | ||||
| continue; | ||||
| echo '<div class="content"><h2><a id="', $type['name'], '">', htmlentities($type['description']), '</a></h2><div><ol>'; | ||||
| while($comic = mysqli_fetch_assoc($comics)) | ||||
| printf('<li><a title="%s" name="%d" href="./strip/%d">%04d - %s</a></li>', $comic['pubdate'], $comic['id'], $comic['id'], $comic['id'], utfentities($comic['title'])); | ||||
| echo '</ol></div></div>'; | ||||
| } | ||||
| } | ||||
| ?> | ||||
| <?php pagefoot() ?> | ||||
| </body> | ||||
| </html> | ||||
