View Full Version : manage content (passing variables problem?)

09-15-2005, 02:39 PM
I'm sort of a newbie to both CF.com and PHP, but after reading this article in ALA (http://alistapart.com/articles/phpcms) got inspired to use the code to manage the content on my website.

Now, my problem is that while the code (see below) works just fine on one server, it does not on another (the one I am using after testing).

It seems that the problem line would be the following:

<a href="template.php?page=kontakt">
which refers to this code in the file template.php:

<div class="innhold">
<?php @ require_once ("$page.php"); ?>

The file "kontakt.php" simply does not show up, even though it should (?).

Does anyone know what is causing my problems?

I would be so grateful, this is really causing me some headache!!


09-15-2005, 02:48 PM
<?php require_once($_GET['page'] . '.php'); ?>
be advised that it is not the smartest thing to include() or require() scripts based on user input without proper validation

09-16-2005, 06:37 AM
Thank you - it works just fine now!
Not that I know why, but...:)

09-16-2005, 07:45 AM
if you don't understand that code, then you realy shoudn't use it. escpecially not since it can be a serious security-risk, like devinemke hinted at. more info http://www.codingforums.com/showthread.php?t=50113&highlight=exploit

what you used is a very old article, that was written for an older PHP version when 'register globals' was still ON (more info http://uk.php.net/register_globals ).
So on the first server, you tried the code, register globals was ON, while on most live servers today, register globals is OFF.