-1); $foundComic--) {
if (file_exists(GenerateFileName($foundComic))) {
break;
}
}
return $foundComic;
}
$numberOfComics = lastcomic();
//************************************
// Check to see which comic user wants to see:
if (isset($_REQUEST['nr'])) {
$requestedNR = $_REQUEST["nr"];
if ($requestedNR == "random") {
$requestedNR = rand(1, $numberOfComics);
} else if (intval($requestedNR) < 0) {
$requestedNR = $numberOfComics;
} else if (intval($requestedNR) > $numberOfComics) {
$requestedNR = 0;
}
} else {
$requestedNR = $numberOfComics;
}
// **********************************
// Make neat the links for the buttons:
$me = $_SERVER['PHP_SELF'];
$linkFirst = $me."?nr=1";
$linkPrev = $me."?nr=".strval($requestedNR - 1);
$linkRand = $me."?nr=random";
$linkNext = $me."?nr=".strval($requestedNR + 1);
$linkNewest = $me."?nr=".$numberOfComics;
$recentPicture = GenerateFileName($requestedNR);
// the above is all you need later on in the html part, for links and stuff.
//This function converts a number into a file name
// for example: it will turn the number 1 into bunbun-comic001.gif or whatever.
// leading zero's:
function GenerateFileName($number) {
$number = substr("000".$number, strlen($number), 3);
$supposedFileName = "pic/images/guest-bunbun/guest-bunbun$number.gif";
//echo "$supposedFileName
\n"; 'uncomment this line to see what i'm looking for
return $supposedFileName;
}
?>
. |