I have folowing code in which i am using some conditions on page to be open or redirected to any other url but php method for calling a url is not working here please any one help me how to get out of this issue
here is my php code
<?php
$good_domains = array("http://172.17.0.221:84/cp.aspx","http://172.17.0.221:84/cp.aspx");
if(!in_array($_SERVER['HTTP_REFERER'],$good_domains)){
echo "<script>alert(\"NO\");</script>";
Redirect('http://www.google.com.pk');
}
else{
echo "<script>alert(\"YES\");</script>";
//echo $_SERVER['HTTP_REFERER'];
//Redirect('http://www.shakarganj.com.pk');
$URL="http://www.google.com";
header ("Location: $URL");
}
?>
When i run the page the folowing error is generated.
Warning: Cannot modify header information - headers already sent by (output started at C:\xampplite\htdocs\a\sfpl\MT.php:9) in C:\xampplite\htdocs\a\sfpl\MT.php on line 15
At the top of your index file add this:
This will remove this warning if i’m not mistaken.