1) CODE TITLE: Basic PHP includes
2) AUTHOR NAME/NOTES: Daniel Ross
3) DESCRIPTION: This script will include various 'pages' of code into an existing page.
4) CODE:
This is very basic PHP for those of us who use it daily, but I just got a question from someone wanting to know how to use PHP includes. Rather than just telling them to use <?php include($_GET['page']); ?>, I suggest this because:Code:START OF PAGE:
<?php
function inc() {
$inc = 'default';
$page = isset($_GET['page'])?$_GET['page']:$inc;
if (file_exists('includes/'.$page.'.txt')) {
$inc = $page;
}
include('includes/'.$inc.'.txt');
}
?>
LINE OF INCLUSION:
<?php inc(); ?>
1. It error checks.
2. By doing so, it prevents hacking/XSS.
Anyway, it's not a standard thing for the library, but I know some people would find it useful.

