Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Sep 2010
    Posts
    65
    Thanks
    4
    Thanked 0 Times in 0 Posts

    What is wrong in this??

    hi all, this is driving me crazy, i don't see anything wrong, its at top no header is being sent before, no space before it, its at top. also ob_start() is not working for me, any one know what is the problem?

    i'm getting this error
    Warning: Cannot modify header information - headers already sent by (output started at D:\Installed Programs\AppServ\www\syllabus.php:1) in D:\Installed Programs\AppServ\www\syllabus.php on line 9

    PHP Code:
    <?php
    if (!isset($_COOKIE['username']) || !isset($_COOKIE['password'])) {
        echo 
    "<META HTTP-EQUIV='Refresh' Content=0;URL='index.php?error=3'>";
    }
    else {
            
    //Renew The Cookies
            
    $myDomain ereg_replace('^[^\.]*\.([^\.]*)\.(.*)$''\1.\2'$_SERVER['HTTP_HOST']);
            
    $setDomain = ($_SERVER['HTTP_HOST']) != "localhost" ".$myDomain" false;
            
    setcookie ("username"$_COOKIE['username'], time()+60*15'/'"$setDomain");
            
    setcookie ("password"$_COOKIE['password'], time()+60*15'/'"$setDomain");
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    html code starts here
    EDIT: I forgot to say, if i delete else{} and leave only if () it works perfectly without any error
    Last edited by TheCracker; 11-17-2010 at 01:27 PM.

  • #2
    Regular Coder
    Join Date
    Jul 2006
    Posts
    399
    Thanks
    33
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by TheCracker View Post
    EDIT: I forgot to say, if i delete else{} and leave only if () it works perfectly without any error
    Obviously, you're echoing then setting cookies this is why you get the error, you need to find other way around this.

  • #3
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,546
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    What happens if you just do this ....
    I'm trying to determine if the problem is just within this part ...

    PHP Code:
    <?php

            
    //Renew The Cookies
            
    $myDomain ereg_replace('^[^\.]*\.([^\.]*)\.(.*)$''\1.\2'$_SERVER['HTTP_HOST']);
            
    $setDomain = ($_SERVER['HTTP_HOST']) != "localhost" ".$myDomain" false;
            
    setcookie ("username"$_COOKIE['username'], time()+60*15'/'"$setDomain");
            
    setcookie ("password"$_COOKIE['password'], time()+60*15'/'"$setDomain");

    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    html code starts here

  • #4
    New Coder
    Join Date
    Sep 2010
    Posts
    65
    Thanks
    4
    Thanked 0 Times in 0 Posts
    @sybil: that is why i asked here because i don't know what is the problem

    @mlseim: u r right, i get the same error in this page, but i use the same code for the log in page but get no error? what do u think is the problem??

  • #5
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Have you checked for a byte order mark (BOM) on your files yet? This can screw everything up in a hurry.

    Notepad++ can save files without BOM if you need it.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #6
    New Coder
    Join Date
    Sep 2010
    Posts
    65
    Thanks
    4
    Thanked 0 Times in 0 Posts
    exactly, i've copied the code in notepad++ and save as, everything went ok

    but do u know how to remove BOM from expression web 12?? i don't want to use it

    thanks a ton friend,
    regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •