Skip to content

Instantly share code, notes, and snippets.

@s1gh
Created July 27, 2013 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s1gh/6095548 to your computer and use it in GitHub Desktop.
Save s1gh/6095548 to your computer and use it in GitHub Desktop.
A simple include script.
<?php
function includePage($GetParameter)
{
if (empty($GetParameter))
{
require('inc/defaultpage.php'); // Default page.
}
else
{
if (file_exists('inc/' . $GetParameter . '.php') && (ctype_alpha($GetParameter))) // Checks if the file exist and that the get parameter only contains characters.
{
require('inc/' . $GetParameter . '.php'); // The file exist. Include and display it.
}
else
{
require('inc/error.php'); // No page with that name. Include an error page.
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment