Albatross Posted July 22, 2007 Share Posted July 22, 2007 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> Quote Link to comment Share on other sites More sharing options...
Albatross Posted July 22, 2007 Author Share Posted July 22, 2007 Just wondering if anyone had any ideas on this. I don't know what other code would be needed but if there's something I can add to this to make it easier, please let me know. Quote Link to comment Share on other sites More sharing options...
trq Posted July 22, 2007 Share Posted July 22, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.