RE: [PHP] example of file_exists() ???
| From: | Richard Creech - DreamRiver.com | Date: | Mon, 30 Oct 2000 10:37:27 +0000 |
| Subject: | RE: [PHP] example of file_exists() ??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22648@lists.php.net to get a copy of this message | ||
Matthias and Everyone who helped,
Thanks a bunch!
Matthias is right, one can't use 'require' in a conditional. I also learned a lot
from everyone who answered. The resulting code is going to be released as freeware so I imagine
everyone wins on this solution ;-)
Kind Regards,
Richard Creech
richardc@dreamriver.com Phone: 250.744.3350 Pacific Time Canada
Get a free link at http://www.dreamriver.com/phpYellow/
Download phpYellow Pages 2000 - Now shipping Version 1.05 with EasySQL!
Add Dynamic Database Content to your Website
http://dreamriver.com/software/
At 10:42 AM 10/30/00 +0100, Matthias Endler wrote:
>Hello Richard,
>
>> if (file_exists("common.php")) {
>> require("common.php");
>> $hostname = DBSERVERHOST;
>> //bring in the rest of the CONSTANTS, do an autologin
>> // more snipped code
>> }else{
>> // do a manual login instead without common.php
>> }
>> ... and so on ...
>>
>> This is the error it gives:
>> Warning: Unable to access common.php
>> Fatal error: Failed opening required 'common.php'
>
>use 'include' instead of 'require' and whole thing should work. You
>can't
>require in a conditional.
>
>Cheers,
>Matthias