• 0

PHP Page


Question

2 answers to this question

Recommended Posts

  • 0

I believe this is what you are looking for:

Make the template page, with all the links, etc in it that you want, and put this php script where you want the content of each page to be shown:

Simple Version

<?
$section = $HTTP_GET_VARS['section'];
if ($section == "") $go = "default";
if (!file_exists("$section.php")) $go = "error";
include("$section.php");
?>

Each include is the name + the php extension. default would be default.php, etc etc.

This script is useful, however not so secure. I reccomend this one, which is a little more advanced, but should keep most of the script kiddies out

Longer Version

     <?
$section = $HTTP_GET_VARS['section'];
$section = ereg_replace('<([^>]|\n)*>', 'default', $section);
$section = ereg_replace('[.]', ' ', $section);
$section = ereg_replace('/', ' ', $section);
$section = ereg_replace('<script>','default', $section);
$section = ereg_replace('index','default', $section);
if ($section == "") $section = "headlines";
if (!file_exists("$section.php")) $section = "error";
include("$section.php");
?>

ereg_replace replaces the first value with the second value.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.