PHP Weird Error Question HELP?

Purple Moogle

New member
It's likely that you either left whitespace before your opening <?PHP tag, or you tried to send a header using either header() or setcookie() after calling print().

You can either modify your script to ensure that you only call header modifying functions before using print() OR you can use output buffering, which caches everything until the end of the script and then outputs. To use output buffering, call ob_start() before calling print() and then optionally call ob_flush() at the end of your script (after any HTML as well).
 
I have this code:
<?php
//Checks if you are at main.php. If you are, you are moved to index.php.
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if ($url == 'http://mydomain.com/st2/admin/main.php' || 'http://www.mydomain.com/st2/admin/main.php'){
header("Location: index.php");
}

?>


and it gives me this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/shanetal/public_html/st2/admin/index.php:9) in /home/shanetal/public_html/st2/admin/main.php on line 5


WHY???
More details at http://shanetalbert.com/myerror.txt
 
Back
Top