Re: securing include()

From: Date: Wed, 16 Apr 2003 10:20:48 +0000
Subject: Re: securing include()
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-144094@lists.php.net to get a copy of this message
Jason Wong wrote:
On Wednesday 16 April 2003 16:17, Alexei Matveev wrote:
include("./" . $body); Are there more elegant ways to do the same?
Use basename() to strip off any leading paths leaving just the filename. Then prepend your own base directory Good, but works only for one directory,
not for (multiple) subdirectories. Ok, I see, opne may replicate the script to serve urlpath/?body=page1.html urlpath/subdir/?body=page2.html Thanks! In fact I need a content wrapper for a simple header body footer layout. Was tired of fixing include(header/footer) everywhere. Is it possible to translate urlpath/page1.html into a call to php script with page1.html as an argument?


« previous php.general (#144094) next »