hey I'm trying to set up Apache to run php files on my windows xp computer. It all went fine, I ran Apache and was able to open the php file in Internet Explorer. The only problem is the pages won't work right. The main page, index.php, works by
It just won't include any files. It works fine on the internet, but won't on my computer. Is there something I haven't configured or something else I have to download? thanks!
You will probably experience that the $page variable seems to be "gone". A search on the web (or this forum) will return many links to people that have experienced the same.
The solution is probably to use $_GET['page']. (Setting register_globals=on isn't a solution on the long term)
I searched for other people with this problem but I couldn't find anything. Sorry, I'm completely new to having php and apache on my computer, where do I put those first 2 lines of code? Into the php command prompt? I tried displaying the variables like you said and nothing was there, like you said, and using GET did work. Is there any way to make the php less touchy (not needing all the extra code)?
//might be a good idea to strip slashes/periods this contains (a url injection could alter the path that's actually used
$page = $_GET['page'];
include_once('C:\Apache\htdocs\includes\' . $page);
You could always use require() rather than include(). include will not produce an error if it cannot locate your file, require() will create an error - and is therefore far more useful from a bug catching perspective...