PHP include() alternative?

Posted by Adrian M. on Stack Overflow See other posts from Stack Overflow or by Adrian M.
Published on 2010-04-11T15:38:37Z Indexed on 2010/04/11 15:43 UTC
Read the original article Hit count: 295

Filed under:
|
|
|

Hello,

I want to know if my code is safe and if there are other safer alternatives to include external files..

So this is my code example, is it safe? How can I make it safer? Thanks!

<?php switch($_GET['p']){
   case 'test1':
      include 'test1.php';
      break;
   case 'test2':
      include 'test2.php';
      break;
   case 'test':
                echo 'something';
      include 'pages/test.php';
                echo 'something';
      break;
   default: 
      include 'main.php';
      break; 
} ?>

© Stack Overflow or respective owner

Related posts about php

Related posts about include