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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.