<? error_reporting (E_ERROR && E_PARSE) ?>
<html>
<head>
<title>The Marvelous Comic Page Generator</title></head>
<body bgcolor=ffffff text=000000 link=003399 alink=000000 vlink=cc0033>
<font face=verdana, helvetica, arial size=2>
<?
if (strlen($s) < 1) {
	if ($r <> 1) {
		?><b>The Marvelous Comic Page Generator</b><br>
		courtesy of <a href="http://www.punkasspunk.com">punkasspunk.com</a><br>
		<br>
		View all comics: <a href="http://www.punkasspunk.com/index.php?s=00010203040506070809101112131415161718192021222324252627282930313233">LINK</a><br>
		Clear the list: <a href="index.php">LINK</a><br>
		<form method="post" action="index.php?r=1"> <?
		$c = 0;
		$d = "00";
		$filename = "comicpage/" . $d . ".txt";
		while (file_exists("$filename")) {
			$fp=fopen("$filename","r");
			$name = fgets($fp,4096);
			?><input type="checkbox" name="cb[<? echo $c ?>]"> <? echo $name;
			$name = fgets($fp,4096);
			?>[<a href="<? echo $name ?>">link</a>]<? echo "<br>";
			fclose($fp);
			$c = $c + 1;
			if ($c < 10) {
				$d = "0" . $c;
			}
			else {
				$d = $c;
			}
			$filename = "comicpage/" . $d . ".txt";
		}
		?> <br><input type="submit" value="Submit"></form>
		<br>
		View all comics: <a href="http://www.punkasspunk.com/index.php?s=00010203040506070809101112131415161718192021222324252627282930313233">LINK</a><br>
		Clear the list: <a href="index.php">LINK</a><?
	}
	else {
		$today = time();
		$d0  = mktime (0,0,0,date("m",$today),date("d",$today)-3,date("Y",$today));
		$d1  = mktime (0,0,0,date("m",$today),date("d",$today)-2,date("Y",$today));
		$d2  = mktime (0,0,0,date("m",$today),date("d",$today)-1,date("Y",$today));
		$d4  = mktime (0,0,0,date("m",$today),date("d",$today)+1,date("Y",$today));
		$d5  = mktime (0,0,0,date("m",$today),date("d",$today)+2,date("Y",$today));
		$d6  = mktime (0,0,0,date("m",$today),date("d",$today)+3,date("Y",$today));
		$day_of_week = date("D",$today);
		$max = 31;
		$string = "";
		?>
		<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d0) ?>"><? echo date("D",$d0) ?></a> 
		<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d1) ?>"><? echo date("D",$d1) ?></a> 
		<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d2) ?>"><? echo date("D",$d2) ?></a> 
		<? echo date("D",$today) ?> 
		<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d4) ?>"><? echo date("D",$d4) ?></a> 
		<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d5) ?>"><? echo date("D",$d5) ?></a> 
		<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d6) ?>"><? echo date("D",$d6) ?></a><br>
			<br>
	Revise your list: <a href="index.php">LINK</a> <?
		for ($c = 0; $c < $max; $c++) {
			if ($cb[$c]) {
				if ($c < 10) {
					$d = "0" . $c;
				}
				else {
					$d = $c;
				}
				$string = $string . $d;
				if ($day_of_week == "Sun") {
					$filename = "comicpage/" . $d . ".sun.txt";
					$fp=fopen("$filename","r");
					if (! $fp) {
						$filename = "comicpage/" . $d . ".txt";
						$fp=fopen("$filename","r");
					}
				}
				else {
					$filename = "comicpage/" . $d . ".txt";
					$fp=fopen("$filename","r");
				}
				$name = fgets($fp,4096);
				$url = fgets($fp,4096);
				?> <a href="<? echo $url ?>"> <?
				echo "<b>" . $name . "</b><br>";
				$name = fgets($fp,4096);
				?> <img border=0 src="<? echo $name;
				$name = fgets($fp,4096);
				echo $name;
				$name = fgets($fp,4096);
				echo date($name,$today);
				$name = fgets($fp,4096);
				echo $name;
				$name = fgets($fp,4096);
				echo date($name,$today);
				$name = fgets($fp,4096);
				echo $name ?>"></a><br><br><br> <?
				fclose($fp);
			}
		}
		?><br>
		<a href="index.php?r=1&s=<? echo $string ?>&d=<? echo date("m/d/Y",$d0) ?>"><? echo date("D",$d0) ?></a> 
		<a href="index.php?r=1&s=<? echo $string ?>&d=<? echo date("m/d/Y",$d1) ?>"><? echo date("D",$d1) ?></a> 
		<a href="index.php?r=1&s=<? echo $string ?>&d=<? echo date("m/d/Y",$d2) ?>"><? echo date("D",$d2) ?></a> 
		<? echo date("D",$today) ?> 
		<a href="index.php?r=1&s=<? echo $string ?>&d=<? echo date("m/d/Y",$d4) ?>"><? echo date("D",$d4) ?></a> 
		<a href="index.php?r=1&s=<? echo $string ?>&d=<? echo date("m/d/Y",$d5) ?>"><? echo date("D",$d5) ?></a> 
		<a href="index.php?r=1&s=<? echo $string ?>&d=<? echo date("m/d/Y",$d6) ?>"><? echo date("D",$d6) ?></a><br>
		<br>
		Revise your list: <a href="index.php">LINK</a><br>
		<br>
		Follow and bookmark this link: <a href="index.php?s=<? echo $string ?>">LINK</a><?
	}
}
else {
	if (strlen($d) < 1) {
		$today = time();
	}
	else {
		if (($today = strtotime($d)) == -1) {
			die("Bad date from " . $d . "</body></html>");
		}
		else {
			$ver = phpversion();
			if ($ver[0] < "4") {
				$today = $today + (60 * 60 * 24);
			}
			#echo("Starting with $d, using date " . date("m/d/Y",$today) . "<br>");
		};
	}
	$d0  = mktime (0,0,0,date("m",$today),date("d",$today)-3,date("Y",$today));
	$d1  = mktime (0,0,0,date("m",$today),date("d",$today)-2,date("Y",$today));
	$d2  = mktime (0,0,0,date("m",$today),date("d",$today)-1,date("Y",$today));
	$d4  = mktime (0,0,0,date("m",$today),date("d",$today)+1,date("Y",$today));
	$d5  = mktime (0,0,0,date("m",$today),date("d",$today)+2,date("Y",$today));
	$d6  = mktime (0,0,0,date("m",$today),date("d",$today)+3,date("Y",$today));
	$day_of_week = date("D",$today);
	$l = strlen($s);
	?>
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d0) ?>"><? echo date("D",$d0) ?></a>
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d1) ?>"><? echo date("D",$d1) ?></a> 
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d2) ?>"><? echo date("D",$d2) ?></a> 
	<? echo date("D",$today) ?> 
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d4) ?>"><? echo date("D",$d4) ?></a> 
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d5) ?>"><? echo date("D",$d5) ?></a> 
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d6) ?>"><? echo date("D",$d6) ?></a><br>
				<br>
	Revise your list: <a href="index.php">LINK</a><br><br><?
	for ($c = 0; $c < $l; $c=$c+2) {
		$d = substr($s, $c, 2);
		if ($day_of_week == "Sun") {
			$filename = "comicpage/" . $d . ".sun.txt";
			$fp=fopen("$filename","r");
			if (! $fp) {
				$filename = "comicpage/" . $d . ".txt";
				$fp=fopen("$filename","r");
			}
		}
		else {
			$filename = "comicpage/" . $d . ".txt";
			$fp=fopen("$filename","r");
		}
		$name = fgets($fp,4096);
		$url = fgets($fp,4096);
		?> <a href="<? echo $url ?>"> <?
		echo "<b>" . $name . "</b><br>";
		$name = fgets($fp,4096);
		?> <img border=0 src="<? echo $name;
		$name = fgets($fp,4096);
		echo $name;
		$name = fgets($fp,4096);
		echo date($name,$today);
		$name = fgets($fp,4096);
		echo $name;
		$name = fgets($fp,4096);
		echo date($name,$today);
		$name = fgets($fp,4096);
		echo $name ?>"></a><br><br><br> <?
		fclose($fp);
	}
	?><br>
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d0) ?>"><? echo date("D",$d0) ?></a> 
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d1) ?>"><? echo date("D",$d1) ?></a> 
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d2) ?>"><? echo date("D",$d2) ?></a> 
	<? echo date("D",$today) ?> 
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d4) ?>"><? echo date("D",$d4) ?></a> 
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d5) ?>"><? echo date("D",$d5) ?></a> 
	<a href="index.php?r=1&s=<? echo $s ?>&d=<? echo date("m/d/Y",$d6) ?>"><? echo date("D",$d6) ?></a><br>
	<br>
	Revise your list: <a href="index.php">LINK</a><br><br><?
}
?>

</body></html>

