4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Including a yet to be created file
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
php4ever
Junior WebHelper
Junior WebHelper


Joined: 10 Oct 2002
Posts: 49

PostPosted: Thu Nov 21, 2002 6:09 am (21 years, 5 months ago) Reply with QuoteBack to Top

Is it possible in PHP to include a file that is non-existant? I know this question may sound a bit bizarre so I'll explain. I recently learned that you can have a .htaccess file in a directory that would have a directive such that all 404s would be directed to a script and that script could create the non-existant files.

I thought that maybe I could write some code like this:

<?php

include_once("http://mysite/subdir/nonexistant.ihtml")
?>

That kind of code will produce an error message

But, if I type in the location area of the browser:

http://mysite/subdir/nonexistant.ihtml


then the .htacess file in subdir activates script2create_files.cgi and within nanoseconds one can view what was formerly a nonexistant file.

I was hoping there was a way to take this a step further with an include. So, if anyone has any ideas about how to do this, pls. let me know.

Thanks.

All best regards,
php4ever
OfflineView User's ProfileFind all posts by php4everSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Thu Nov 21, 2002 7:13 am (21 years, 5 months ago) Reply with QuoteBack to Top

Try include("http://www.yoursite.com/page.html");. Then PHP will try to access it just like you are.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Thu Nov 21, 2002 7:26 pm (21 years, 5 months ago) Reply with QuoteBack to Top

Daniel wrote:
Try include("http://www.yoursite.com/page.html");. Then PHP will try to access it just like you are.
good idea...I was going to suggest checking if the file exists, and if it doesn't creating it before it is included...but daniel's idea is FAR less code...

________________________________
It's turtles all the way down...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.201041 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme