Jump to content

PHP script photo gallery HELP


yoda87

Recommended Posts

Hi all, i've set this script for my gallery, it works, it display me the name of the albums, but when i click to see the pictures inside, the page is blank, and also don't appear the "Back to the albums" link, i can't find the error in the code...  :confused:

 

<html> 
<head> 
<script type="text/javascript" src="../lightbox2.05/js/lightbox.js">
</script> 
</head> 
<body>   
<?php  
$page = $_SERVER['PHP_SELF'];  
//settings 
$column = 5;  
//directories 
$base = "carrelli_noleggio"; 
$thumbs = "thumbs";  
// get album 
$get_album = $_GET['album'];  
//if no album selected 
if (!$get_album) {     
echo "<b>Select an album:</b><p />";  
//find each album and display as links 
$handle = opendir($base);     
while (($file = readdir($handle))!==FALSE)     
{ 
if (is_dir($base."/".$file) && $file != "." && $file != ".." && $file != $thumbs)        
{             
echo "<a href='$page?album=$file'>$file</a><br />";         
}     }     
closedir($handle); } 
else {     
//check if album exist, and additional security checks     
if (!is_dir($base."/".$get_album) || strstr($get_album,".") !=NULL || strstr($get_album,"/") !=NULL || strstr($get_album,"\") !=NULL)     {     
echo "Album doesn't exist.";     } 
else {    
$x = 0;     
echo "<b>$get_album</b><p />";     
$handle = opendir($base."/".$get_album); 
while (($file = readdir($handle)) !== FALSE)     
{         
if ($file != "." && $file != "..")        
{         
echo "<table style='display:inline;'><tr><td><a href='$base/$get_album/$files' ref='lightbox'<img src='$base/$thumbs/$file' height='100' width'100'></a></td></tr></table>"; 
$x++; 
if ($x==$column)         
{ 
echo"<br />";             
$x = 0;         
}     
  }   
    }     
closedir($handle);          
echo "<p /><a href='$page>Back to albums</a>";  } } 
?> 
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/236088-php-script-photo-gallery-help/
Share on other sites

The \ in this line is escaping the quote, you need to add another quote!

if (!is_dir($base."/".$get_album) || strstr($get_album,".") !=NULL || strstr($get_album,"/") !=NULL || strstr($get_album,"\") !=NULL)  

 

Add quote:

if (!is_dir($base."/".$get_album) || strstr($get_album,".") !=NULL || strstr($get_album,"/") !=NULL || strstr($get_album,"\"") !=NULL) 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.