Iām trying to create a basic(and loads optimally) comic engine. I would have no problem if i was using a MySQL DB. But i want to do it without a DB.
So anyway, how do i go about doing this? Ive made it as far as to make it all work perfectly fine, if you were just wanting to browse them like photos. But i cant make it go to a specific comic depending on the URL. (Eg www.yourdomain.com/comic.php?comic=4).
This is what ive written thus far:
comic.php:
<?php
session_start();
session_register("comic");
require("config.php");
if ($_SESSION['comic'] < 1){$_SESSION['comic'] = 1;}
$count = count(glob($comic_dir . "/*" . $ext));
$Next_Prev = $_GET['Next_Prev'];
switch ($Next_Prev)
{
case 'Next':
if ($_SESSION['comic'] == $count) {} else {$_SESSION['comic']++;}
break;
case 'Prev':
if ($_SESSION['comic'] == 1){ }else {$_SESSION['comic']--;}
break;
case 'First':
$_SESSION['comic'] = 1;
break;
case 'Latest':
$_SESSION['comic'] = $count;
break;
}
echo $_SESSION['comic'];
?>
<html>
<body>
<center>
<p><img src="comic/<?=$_SESSION['comic'] . $ext?>"></p>
<form name="Next_Prev" method="get" action="">
<input name="Next_Prev" type="submit" class="test" id="First" value="First">
<input type="submit" name="Next_Prev" id="Prev" value="Prev">
<input type="submit" name="Next_Prev" id="Next" value="Next">
<input type="submit" name="Next_Prev" id="Latest" value="Latest">
</form>
</center>
</body>
</html>
config.php:
<?php
// The directory of the comic's.
$comic_dir = "comic";
//The file extension your comics use. Do not get rid of the . at the begining.
$ext = ".jpg";
?>