Jump to content

Using the redirect by date function


Albatross

Recommended Posts

Heya once again....this time i think it's fairly straigtforward but I have the redirect based on date code but it's not redirecting.  Can I get an opinion on what I'm doing wrong here please  (and the sunday code wouldn't work at all for some reason):

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>FatMan™Inc</title>
<style type="text/css">
<!--
body {
background-color: #CCCCCC;
background-image: url(cvgbg.gif);
background-repeat: repeat-x;
}
-->
</style> 
<style type="text/css">
a:link, a:visited{color: #CC9966;text-decoration: none;
}
.style24 {color: #3A5C9F; font-style: italic; }
.style26 {
font-size: xx-large;
color: #3A5C9F;
}
.style27 {font-size: 14px}
</style>
</head>
<body>
<?php
$hour = date('G');
$minute = date('i');
$day = date('w');
$m = $hour * 60 + $minute;
if(
$day == 4
&& $m >= 480
&& $m <= 1380
) header("Location: www.phpfreaks.com/forums/index.php");
else if(
$day == 5
&& $m >= 480
&& $m <= 720
) header("Location: www.phpfreaks.com/forums/index.php");
else if(
$day == 6
&& $m >= 1
&& $m <= 1439
) header("Location: www.phpfreaks.com");
else if(
$day == 1
&& $m >= 1
&& $m <= 1439
) header("Location: www.phpfreaks.com");
else if(
$day == 2
&& $m >= 1
&& $m <= 1439
) header("Location: www.phpfreaks.com");
else if(
$day == 3
&& $m >= 1
&& $m <= 1439
) header("Location: www.phpfreaks.com");
?>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/61191-using-the-redirect-by-date-function/
Share on other sites

You cannot output anything prior to calling the header() function. If you had error reposrting on you would see a header error.

 

Re-arrange your logic so there is no html or anything else outputted prior to the header() call. there is no point having anything outputted anyway if all your going to do is redirect.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.