...

View Full Version : Linking question:



Temper
02-24-2003, 10:57 PM
I've forgotten how to make links that use a page and then include information. Ok, so that wasn't clear at all, I'll try to explain:
Say I have a a page (index.php) and I want to keep the index layout on all my pages, so I have a link set up that will display the content wherever I want it on the page. When the link is placed, the adress will look like "index.php?inc=content". Once it hits that link, the layout will stay the same, but the content will change. I've done this before a long time ago, and since then I've deleted my examples. All I remember is that it involved this piece of code:

<?php
include($_GET['content'] . '.php');
?>



I'm not sure if to some people it seems really obvious, but I'm not strong in php, and this may be all of the code I need, but I don't know how to use it properly.
Any help would be nice.
~Mike

Nightfire
02-24-2003, 11:29 PM
Close :)



<?
include($_GET['inc'].'.php');
?>


It's the value of inc you want, not content :)

Dylan Leblanc
02-24-2003, 11:45 PM
I would advise against doing that for security reasons.

At least validate the incoming data



<?

if (in_array($_GET['inc'], array('array', 'of', 'valid', 'page', 'filenames'))) {
include($_GET['inc'].'.php');
}

?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum