Is there any way to safely include pages without putting them all in an array?
if (preg_match('/^[a-z0-9]+/', $_GET['page'])) { $page = $_GET['page'].".php"; $tpl = $_GET['page'].".html"; if (file_exists($page)) include($page); if (file_exists($tpl)) include($tpl); }
What should I add to make this pretty safe?
I'm doing it this way bacause I don't like having to include stuff that has to be included on all pages. The "include header > content > include footer"-way. I don't wanna use any template engines/frameworks neither.
Thanks.