|  | Posted by burke on 03/22/06 20:46 
Badr.ALmuzini@gmail.com wrote:> hi,there
 >
 > how can i make php file extension hidden in the URL somthing like this
 > (http://mail.google.com/mail/?view)
 >
 > Regard....
 >
 
 Here's what I've done in the past:
 
 (index.php)
 switch($_GET['id'])
 {
 case 'main':
 require 'main.php';
 break;
 case 'about':
 require 'about.php';
 break;
 default:
 require 'main.php';
 break;
 }
 
 then you could type http://yourdomain?id=main
 
 if you really wanted to drop the ID part, you'd have to use multiple
 ifs, not a switch.
 
 Just never, ever use unsanitized input from $_GET/$_POST.
 
 ie. this is *bad*:
 
 require '$_GET['id']'.'.php';
 
 bad, bad, bad. Don't. ;)
 
 As for a performance hit, I've never noticed one, but I don't run
 large-scale websites, so take my experience with a grain of salt.
 
 Sorry if my PHP isn't up to par, I'm thinking in Ruby lately.
  Navigation: [Reply to this message] |