Plik
Veteran Member
Posts: 1489 Reputation: 46
35 / / –
Joined: Jun 2004
|
RE: RE: Can someone edit this script?
quote: Originally posted by Hobbes
Ill ask my host now
edit: No it doesnt support php5. Maybe u can do it with another version of php?
Done
code: <?php
if(!isset($_GET['num']) OR $_GET['num'] < 1){//If the input is less than one correct it
$num = "1";
}
else{
$num = $_GET['num'];//Only use the get varible if it exists or is >1
}
?>
<img src="http://www.hobbes.weirdfish.net/strips/strip<?echo $num;?>.jpg" alt="strip<?echo $num;?>.jpg error" /><br />
<?php
//first we count the files in the strips
$fileno = count_files("strips");
if($num < $fileno){//If we are on the last line dont echo a link other wise do
$next = $num + 1;
echo "<a href=\"http://hobbes.weirdfish.net/strip.php?num=" . $next . "\">Forward</a> - ";
}
if($num > 1){//check to see if the number is greater than one, if so echo the back link
$prev = $num - 1;
echo "<a href=\"http://hobbes.weirdfish.net/strip.php?num=" . $prev . "\">Back</a>";
}
//other wise just dont echo anything
//file counting function
function count_files($dir){
$dh = opendir($dir);
$files = array();
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
sort($files);
array_splice($files, 0, 2);
$filesnum = count($files);
return $filesnum;
}
?>
This post was edited on 03-26-2005 at 02:32 PM by Plik.
|
|