I made a redirect script as listed below... no matter what value of p is passed, even if valid, it is redirected to the default.htm page... essentially it is skipping the if/else part and always going to the else.
Is there something special about the php header function where it is disregarding the conditional statements?
<?php
/*
Use the following link format:
<a href="goto.php?p=XXXXXX">XXXXXX</a>
*/
$p = $_GET['p'];
$link = array(
/*Links*/
'link1'=>'/link1.htm',
'link2'=>'/link2.htm',
);
/*Send Headers*/
header('Content-Type: text/html; charset=utf-8');
header('X-Robots-Tag: noindex, nofollow, noarchive', true);
if (in_array($p, $link))
{
header('Location: '.$link[$p]); // Valid p
}
else
{
header('Location: /default.htm'); // Invalid p
}
exit();
?>