Hi,
I've got a script that is installed on a Solaris machine that is having 
difficulties, and I'm wondering if anyone can help.

The script is trying to access and read files within a directory, pull some 
at random and put them in a webpage.


The path is correct, the directory is set to 755 and I can view the files 
when I browse in. The script is up and running perfectly on two other 
servers - one on Red Hat Linux and one on Win2k.


The script is this:
    <?php
// This pulls 3 random banners from the appropriate
// subdirectory of the images section of the site
$i=-1;
$banners=opendir($SECTION_SIDEBAR_BANNERS);
if ($banners != FALSE) {
while (($file = readdir($banners)) != FALSE)
    if ($file != "." && $file != "..") $banner_list[$i++]=$file;
closedir($banners);
$l=sizeof($banner_list);
if ($l!=0) {
for ($i=0;$i<3;$i++) {
   $ad=$banner_list[rand(0,$l)];
   if (empty($ad)) { $i-=1; continue; }
   $imginfo=getimagesize("$SECTION_SIDEBAR_BANNERS/$ad");
   $link=str_replace('.gif','',$ad);
   $link=str_replace('.jpg','',$ad);
   $link=str_replace('_','/',$ad);
   echo "
    <div class='sidebar-banner-slot'>
     <a href='$SECTION_URL"."ad-clickthrough.htm?AD_URL=$link'><img src='".
     $SECTION_SIDEBAR_BANNERS_URL.
     "/$ad' height='$imginfo[1]' width='$imginfo[0]' border='0' alt='Visit
$link' /></a>
    </div>";
}
} // $l != 0
} // $banner != FALSE
?>

The problem on the solaris machine is that opendir is getting in to the
directory but from that point the server won't let the script read the
files. It kicks back the error:

Warning: 1 is not a valid Directory resource in
/data0/foo.org/members/foo/foo/html/destinations/templates/foo.footer.php
on line 20
(Identifying directories are foo'd out)

Since it kicks back the "1" and not a false, it seems it's getting access
but then not being permitted. Here's something else  - the problem is
intermittent: sometimes the script can grab the images and others not.

Can anyone help?

Many thanks in advance.

NIck




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to