i get an error message on the script below when i run it on my server but only on the first photo - after that it works. what might be the problem? suggestions? my site is on http://www.fotografiskt.com/bilder/
script:
[php]
Gallery
body { background-color: #eeeeee; }
td { font-family: verdana,arial,sans-serif; font-size: 10px; color: #000000; }
a { color: #000000; }
<?
// links display
$gal = $HTTP_GET_VARS["gal"];
$pic = $HTTP_GET_VARS["pic"];
$n = 1;
$links = array();
$fp = fopen("links.txt", "r");
while (!feof($fp)) {
$link = fgets($fp, 500);
if($link) {
$links[$n] = rtrim($link);
$n++; } }
fclose($fp);
for ($i=1; $i<=sizeof($links); $i++) {
echo "".$links[$i]."";
if ( $i<=(sizeof($links)-1)) { echo " | "; } }
?>
<?
// photo display
if (!isset($gal) or trim($gal)=='') {
$gal = 1; }
if (!isset($pic) or trim($pic)=='') {
$pic = 1; }
$dir= "gallery".$gal;
@$d = dir($dir);
if ($d) {
while($entry=$d->read()) {
$entry = preg_replace("/ /","%20",$entry);
$pos = strpos (strtolower($entry), ".jpg");
if (!($pos === false)) {
$arr_pic[] = $dir."/".$entry; } }
$d->close(); }
@sort ($arr_pic);
$total = sizeof($arr_pic);
echo "";
?>
<?
// comments display (if exists)
$cmt = $dir.".txt";
if (file_exists($cmt)) {
$n = 0;
$comment = array();
$fp = fopen($cmt, "r");
while (!feof($fp)) {
$tekst = fgets($fp, 5000);
if ($tekst) {
$comment[$n] = stripcslashes($tekst);
$n++; } }
fclose($fp);
echo $comment[$pic-1]; }
?>
<?
// navigation display
if ( $pic<2) {
$prev_url="?gal=".$gal."&pic=1";
} else {
$prev_url='?gal='.$gal.'&pic='.($pic-1); }
if ( $pic+1>$total) {
$next_url="?gal=".$gal."&pic=".$pic;
} else {
$next_url='?gal='.$gal.'&pic='.($pic+1); }
if ( $pic-10<1) {
$skip_back_url='?gal='.$gal.'&pic=1';
} else {
$skip_back_url='?gal='.$gal.'&pic='.($pic-10); }
if ( $pic+10>$total) {
$skip_url='?gal='.$gal.'&pic='.$total;
} else {
$skip_url='?gal='.$gal.'&pic='.($pic+10); }
echo "Skip 10 | ";
echo "Prev | ";
echo $pic." of ".$total." | ";
echo "Next | ";
echo "Skip 10";
?>
|
[/php]
MOD EDIT: Added PHP bb code tags