View Full Version : index.php?id= problem

03-19-2009, 09:28 AM

I'm new to PHP, so I'm working on my first PHP site which uses the following code that I found on the Internet:

<?php $found = FALSE; if(file_exists("$id.php")) {include("$id.php"); $found = TRUE;} if(!$found) {include("about.php");}?>

The site works fine on my own web server, but on the client's server if I click on the page links it always includes the about.php file.

Can anyone please help me with this? Do I have to contact the client's web hosting company?

My own webserver (PHP Version 5.2.0-8+etch13):

Client's server (PHP Version 5.1.6):

Could the different PHP versions causing this problem?

Thanks in advance!

03-19-2009, 11:11 AM
It sounds like your client's server has register_globals disabled so what you have won't work. This probably will though.

<?php $id = htmlentities($_GET['id']); $found = FALSE; if(file_exists("$id.php")) {include("$id.php"); $found = TRUE;} if(!$found) {include("about.php");}?>

03-19-2009, 11:21 AM
Aerospace Eng... BULLS EYE!!!!

Thanks alot for solving this problem!

Gentle Greetz,