Hi there,
I've had my website hacked and setup as a spam engine. So I've decided to learn how to secure my PHP code which I never bothered about before.
Hoping that someone could help me out with this. is it secure?
<?php
//
$page = $_GET['page'];
if ($page == "") {
$page="xxx.php";
} // Sets Default Page To xxx.php
$valid_pages = array(
"xxx.php" => "",
"zzz.php" => "",
"yyy.php" => "");
if (!isset($valid_pages[$page])) {
// Abort the script
die("404 - File not found");
}
?>
// header stuffer
<?php include($page); ?>
// more stuff
I pass the $page value via the url from a html link like this;
<a href="http://www.mywebsitesomewhere.bla/?page=zzz.php">zzz</a>