azukah Posted August 4, 2010 Share Posted August 4, 2010 i'm trying to use this code to detect if the browser of the user is IE (any version) and id true (if it is IE), then it's redirected to an error page; otherwise, it's ok and sent ot the index. I get the following error... Warning: Cannot modify header information - headers already sent by (output started at /index.php:1) in /xie.php on line 13 any ideas.. ??? <?php function ae_detect_ie() { if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) return true; else return false; } if (ae_detect_ie()) { header("Location: error.php"); } else { header("Location: index.php"); } ?> Link to comment https://forums.phpfreaks.com/topic/209734-help-with-detect-and-redirect-code/ Share on other sites More sharing options...
trq Posted August 4, 2010 Share Posted August 4, 2010 Have you read the 'HEADER ERRORS' sticky? Link to comment https://forums.phpfreaks.com/topic/209734-help-with-detect-and-redirect-code/#findComment-1094883 Share on other sites More sharing options...
azukah Posted August 4, 2010 Author Share Posted August 4, 2010 yes, i did and i have no spaces or extra characters. Link to comment https://forums.phpfreaks.com/topic/209734-help-with-detect-and-redirect-code/#findComment-1094891 Share on other sites More sharing options...
trq Posted August 4, 2010 Share Posted August 4, 2010 yes, i did and i have no spaces or extra characters. You MUST have output. The error even tells you its on line 1 of index.php. Link to comment https://forums.phpfreaks.com/topic/209734-help-with-detect-and-redirect-code/#findComment-1094900 Share on other sites More sharing options...
azukah Posted August 4, 2010 Author Share Posted August 4, 2010 that's what i don't get ... line 1 of my index is <?php require_once('xie.php');?> Link to comment https://forums.phpfreaks.com/topic/209734-help-with-detect-and-redirect-code/#findComment-1094904 Share on other sites More sharing options...
newbtophp Posted August 4, 2010 Share Posted August 4, 2010 that's what i don't get ... line 1 of my index is <?php require_once('xie.php');?> Then check xie.php! Link to comment https://forums.phpfreaks.com/topic/209734-help-with-detect-and-redirect-code/#findComment-1094905 Share on other sites More sharing options...
azukah Posted August 4, 2010 Author Share Posted August 4, 2010 i did check that one too and nothing... i guess i'll check again tomorrow with fresh eyes. i can't find anything right now - thanks for the help mate! cheers. Link to comment https://forums.phpfreaks.com/topic/209734-help-with-detect-and-redirect-code/#findComment-1094906 Share on other sites More sharing options...
Pikachu2000 Posted August 4, 2010 Share Posted August 4, 2010 If the code above was copy/pasted from your script, there's a blank line above the <?php open tag. Link to comment https://forums.phpfreaks.com/topic/209734-help-with-detect-and-redirect-code/#findComment-1094909 Share on other sites More sharing options...
azukah Posted August 7, 2010 Author Share Posted August 7, 2010 no, i actually typed it all (no copy+paste). no idea what was wrong.i just moved it all to a new page and it works fine - thanks all for ur help!! Link to comment https://forums.phpfreaks.com/topic/209734-help-with-detect-and-redirect-code/#findComment-1096266 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.