Posted By

ahdriel on 07/09/11


Tagged

get php include nice verification fileexists


Versions (?)

Nice Include by GET with Verification


 / Published in: PHP
 

  1. if(isset($_GET['menu'])){
  2. $menu = mysql_real_escape_string($_GET['menu']);
  3. $menu = explode('.', $menu);
  4. $ext = (isset($menu[1])) ? '.'.$menu[1] : '.php';
  5. $link = $menu[0].$ext;
  6. if (file_exists($link)) {
  7. include '$link';
  8. } else {
  9. include '404.php';
  10. }
  11. } else {
  12. include 'home.php';
  13. }

Report this snippet  

You need to login to post a comment.