RE: [PHP] RE: help, weird include problem with functions

From: Date: Fri, 10 Aug 2001 12:22:57 +0000
Subject: RE: [PHP] RE: help, weird include problem with functions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-62166@lists.php.net to get a copy of this message
Renze, I found that it works if I pass only a variable or a path in, not both. e.g. opendir("/path/to/foo") works opendir("$variable") where variable contains "path/to/foo" also works opendir("$somevar/some/path") does NOT work. go figure. cheers, jaxon > -----Original Message----- > From: Renze Munnik [mailto:renze@datalink.nl] > Sent: Friday, August 10, 2001 4:06 AM > To: jaxon@salamander.net > Subject: Re: [PHP] RE: help, weird include problem with functions > > > On Thu, Aug 09, 2001 at 02:05:24PM -0400, Jaxon wrote: > > yes, I'm sure the directory exists :) > > > > here is the actual code, I suppose this would have been more helpful to > > start: > > > > <?php > > function incl_common() > > { > > global $modroot; //modroot is defined as > > http://localhost/modules in a > > settings file > > > > echo "<br>$modroot from included"; //this echos > "http://localhost/modules" > > properly > > > > > > //the below throws the error, OpenDir: No such file or > directory (error 2) > > in (this function file name) > > //but I can replce the $modroot/common with a hard-coded path > and it works > > fine. > > > > $handle=opendir("$modroot/common"); > > while ($file = readdir($handle)) > > { //load files in $directory into array > > if ($file != ".." && $file != ".") > > { > > $files_to_include[count($files_to_include)] = $file; > > } > > } > > > > //clean up and sort > > closedir($handle); > > if (is_array($files_to_include)) > > { > > while (list ($key, $val) = each ($files_to_include)) > > { > > include "$modroot/common/$val"; > > } > > } > > } > > incl_common(); > > ?> > > Well... Actualy I can't find anything about opening URL's with > opendir(). Is it even possible? I don't think so. But if is it, I'd > check this: > > - Is the directory readable for the webserver? > - Does your webserver allow this kind of actions? I'd say it's a bit > of a security leak if anyone can just directly execute an > opendir() (and then ofcourse also a readdir()) on your directories > from a remote server. > > But anyway, I don't know if it's possible to do an opendir() on an > URL. I've tried your example on my on server and I can't get it to > work unless I give the actual directory instead of the URL. > > -- > > * R&zE: > > -- »»»»»»»»»»»»»»»»»»»»»»»» > -- Renze Munnik > -- DataLink BV > -- > -- E: renze@datalink.nl > -- W: +31 23 5326162 > -- F: +31 23 5322144 > -- M: +31 6 21811143 > -- H: +31 23 5516190 > -- > -- Stationsplein 82 > -- 2011 LM HAARLEM > -- > -- http://www.datalink.nl > -- «««««««««««««««««««««««« >

« previous php.general (#62166) next »