Created
July 27, 2013 17:18
-
-
Save s1gh/6095548 to your computer and use it in GitHub Desktop.
A simple include script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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