Nice Include by GET with Verification


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.