Re: [SMARTY] fetch template errors?!
| From: | Manfred Stienstra | Date: | Thu, 08 May 2003 13:35:49 +0000 |
| Subject: | Re: [SMARTY] fetch template errors?! | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9508@lists.php.net to get a copy of this message | ||
On Thursday 08 May 2003 13:28, Ben wrote:
> hi folks,
>
> i got the following code in a php file using smarty:
>
> $content_tmpl_file = $_REQUEST['ct'].".tmpl";
> $tmpl->display($content_tmpl_file);
>
> $_REQUEST['ct'] <<--- gets filenames (without ending) of the
> name of the templatefile.... so far so good.
>
> but if there'd be a request with a non existing templatefile,
> there just comes a smarty error that the file couln'd be opened
> or sth. like this.
> if this happens to a customer it's not that fine, so does sb. know
> a solution how to catch such errors and let me / my script react
> in any way?
Using user input without checking it thoroughly is a security issue and you
should never use a statement like this is a production enviroment. You could
use an array with all the template names you want to allow and check if the
current input is in this array.
Manfred