Hmm, well, it seems it i was correct about the directory rights.
/gallery/ only allowed the owner to read/write/execute whereas I was executing the command from outside the owner area so it wouldn't let me.
It is fixed now, however, i have another problem.
PHP Code:
<?php
if (isset($_GET['gallery'])) { //show specified gallery
$gallery = $_GET['gallery'];
$gallery = ereg_replace("_"," ",$gallery);
$page_title = '- Gallery for ' . $gallery;
include_once 'includes/header.inc.php';
function isPicture($file)
{
$file = strtoupper($file);
$pos = (strpos($file,".JPG")||strpos($file,".GIF")||strpos($file,".PNG"));
if($pos>0) return true ;
else return false;
}
?>
<div id="main">
<h3>Gallery for <?=$gallery?> (<a href="galleries.php">Back to Galleries</a>)</h3>
<?php //Request the gallery
$gallery = ereg_replace(" ","_",$gallery);
$galleryDir = dir('/gallery/' . $gallery);
if (isset($_GET['photo'])){ //show specified photo
$photo=$_GET['photo'];
echo "<img src=\"/gallery/$gallery/$photo\" alt=\"\" /><br />";
while ($afile = $galleryDir->read())
{
if(isPicture($afile))
{
echo "<a href=\"viewgallery.php?gallery=$gallery&photo=$afile\"><img src=\"/gallery/$gallery/thumbs/$afile\" alt=\"\" class=\"gallery\" /></a>";
}
}
} else { //Request all galleries.
while ($afile = $galleryDir->read())
{
if(isPicture($afile))
{
echo "<a href=\"viewgallery.php?gallery=$gallery&photo=$afile\"><img src=\"/gallery/$gallery/thumbs/$afile\" alt=\"\" class=\"gallery\" /></a>";
}
}
}
} else { Header("Location: galleries.php"); } ?>
</div>
<?php include_once 'includes/footer.inc.php';?>
This is my code for viewing the gallery.
This is the error I am getting.
Warning: dir(/gallery/15th_December_2004): failed to open dir: No such file or directory in /home/ptulip/public_html/viewgallery.php on line 30
Fatal error: Call to a member function on a non-object in /home/ptulip/public_html/viewgallery.php on line 48
These are the corresponding lines.
Line 30
$galleryDir = dir('/gallery/' . $gallery);
while ($afile = $galleryDir->read())
Any ideas?
Bookmarks