In article <[EMAIL PROTECTED]>, 
> Hi,
> I wrote a few days ago and have heard nothing - can ANYONE help with this:
> 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
> ?>

I'm not quite sure what to make of that in the format presented. The only 
opendir I see there appears to be on what might be line 5??

Anyway, I suggest that you stick some echo's in your code in appropriate 
places to maybe return the string that is being passed to the offending 
function, and maybe do a query on the perms of the offending item to see 
if that gives any clues.

> 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/ 
> 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

David Robley
Temporary Kiwi!

Quod subigo farinam

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to