$gtod1 = gettimeofday(); // Thanks to Steve Napierski for the following addition, which should allow // the code to work on more systems. if(!isset($_GET['date'])) { $date=date("Y-m-d", time()); } else { $date=$_GET['date']; } if(isset($_GET['reactie'])) { putcomment($_POST['name'], $_POST['comment']); } // ----------------------------------------------------------------------------- // PHP webcomic update script v. 2.1 by Jim Newberry with lots // of help from Doug Shepherd's excellent article, located here: // http://www.webtools.com/story/scripting/TLS20000421S0001 // // Yes, I'm aware the article is no longer available. But I gotta // give credit where it's due... so the link remains until I locate // another version of the article :) // // To get a copy of this script, visit www.lifeofwily.com/walrus // ----------------------------------------------------------------------------- // // The following variables must be customized as indicated. // Absolute path to your comic image files. Don't include a "/" on the end. This value // is not a URL (http://...). It is the location of your website files on your host server. // If you don't know it, ask your host or consult their FAQ. $comic_path = "/export/home/student/0764944/public_html/marbles/strips"; // This is the relative URL of your comic image files. If this file is located at // http://www.yoursite.com/index.php, and your comics are in the http://www.yoursite.com/strips // directory, then the URL would be "strips". This value can be EITHER relative (as the example // shows, or a full HTTP address: "http://www.yoursite.com/strips". $comic_url = "strips"; // Change the following variable to the suffix your comic files will use, // for instance, if they are GIFs, use ".gif", ".png" for PNGs, and so on. // This means all your comic files must be the same extension. $image_suffix = ".jpg"; // This variable indicates whether or not you want the script to display comic images. // In other words, you could just put your strips in .html files and have the script // pull them that way. IMPORTANT: Either $strips or $news MUST be "yes" or you won't // see either. They can BOTH be "yes" if you want. $strips = "yes"; // "yes" or "no" // This variable indicates whether or not you want the script to display news posts $news = "yes"; // "yes" or "no" // Absolute path to the files containing your news posts. Don't include a "/" on the end. // This value is not a URL (http://). It is the location of your website files on your host // server. If you don't know it, ask your host or consult their FAQ. $news_path = "/export/home/student/0764944/public_html/marbles/news"; // Change the following variable to the suffix your news posts will use, // if they are HTML files, use .htm or .html. Be sure to include the "." $news_suffix = ".htm"; // Change $first_strip to the date ("YYYY-MM-DD") of your first comic. This // variable will control the "first" link in the navigation menu. $first_strip = "2006-02-14"; // For all practical purposes, leave this next variable alone unless you want to help // me debug the problem where the most recent comic displays twice if its filename // doesn't match today's date -- 86400 is fine even if you don't update every 24 hours, // or even only once a week, or Monday Wednesday Friday. I repeat, if you change this // variable, you might have trouble :) $update_interval = "86400"; // default "86400", 24 hours. Read above info. // ----------------------------------------------------------------------------- // Only change PHP code beyond this notice if you know what you're doing :) // ----------------------------------------------------------------------------- $version_url = "http://www.lifeofwily.com/walrus/images"; // location of current version GIF if ( ereg("^[0-9]{4}-[0-9]{2}-[0-9]{2}$", $date) ) $todays_strip = $date; else $todays_strip = date("Y-m-d", time()); function next_strip ($date) { global $comic_path; global $image_suffix; global $update_interval; $today = date("Y-m-d"); $epoch = mktime(0, 0, 0, substr($date, 5, 2), substr($date, 8, 2), substr($date, 0, 4)); while ($epoch = $epoch + $update_interval) { $newdate = date("Y-m-d", $epoch); if ($newdate > $today) { return ''; } if (file_exists($comic_path . "/" . $newdate . $image_suffix)) { return $newdate; } } } function previous_strip ($date) { global $comic_path; global $first_strip; global $image_suffix; global $update_interval; $epoch = mktime(0, 0, 0, substr($date, 5, 2), substr($date, 8, 2), substr($date, 0, 4)); while ($epoch = $epoch - $update_interval) { $newdate = date("Y-m-d", $epoch); if ($newdate < $first_strip) { return ''; } if (file_exists($comic_path . "/" . $newdate . $image_suffix)) { return $newdate; } } } $previous = previous_strip($todays_strip); $next = next_strip($todays_strip); // ----------------------------------------------------------------------------- // Now your HTML code begins. Be careful of the PHP scripts scattered within :) // ----------------------------------------------------------------------------- ?>
|
if ($strips != "yes") { // if $news is not "yes", display nothing
} elseif (file_exists($comic_path . "/" . $todays_strip . $image_suffix)) {
?>
|
|
All stuff (c) Marc de Wolf and Govert van der Heijden Member of Transplant Comics |