Header warnings??? Why??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil Powell

    Header warnings??? Why??

    // REDIRECT THEM BACK TO LOGIN
    if ($hasSubmittedU sername) {
    header("Locatio n: http://$SERVER_NAME/fslogin.php?err orMsg=" .
    urlencode($font . '<font color=000099><l i>Password
    emailed</li></font></font><p>') .
    '&username=' . urlencode($user name));
    }

    ?>

    <html>
    <head>
    <title><?= $brand ?> Login: Forgot Password</title>

    Based on this code snippet (and there is nothing being written to the
    headers prior to header("Locatio n.."), why am I getting the following:

    Warning: Cannot add header information - headers already sent by (output
    started at /home/youth/finesocceryouth sessions-www/fsforgot.php:15 ) in
    /home/youth/finesocceryouth sessions-www/fsforgot.php on line 114

    The line is the header() line. Furthermore, instead of being redirected to
    fslogin.php I am still at fsforgot.php! Can someone help me quickly, I'm on
    a tight deadline!

    Thanx
    Phil


  • Ian.H [dS]

    #2
    Re: Header warnings??? Why??

    On Fri, 15 Aug 2003 16:56:58 -0400 in
    <message-id:NOb%a.2803$3 M4.744@lakeread 04>
    "Phil Powell" <soazine@erols. com> wrote:
    [color=blue]
    > // REDIRECT THEM BACK TO LOGIN
    > if ($hasSubmittedU sername) {
    > header("Locatio n: http://$SERVER_NAME/fslogin.php?err orMsg=" .
    > urlencode($font . '<font color=000099><l i>Password
    > emailed</li></font></font><p>') .
    > '&username=' . urlencode($user name));
    > }
    >
    > ?>
    >
    > <html>
    > <head>
    > <title><?= $brand ?> Login: Forgot Password</title>
    >
    > Based on this code snippet (and there is nothing being written to the
    > headers prior to header("Locatio n.."), why am I getting the following:
    >
    > Warning: Cannot add header information - headers already sent by
    > (output started at
    > /home/youth/finesocceryouth sessions-www/fsforgot.php:15 )
    > in/home/youth/finesocceryouth sessions-www/fsforgot.php on line 114
    >
    > The line is the header() line. Furthermore, instead of being
    > redirected to fslogin.php I am still at fsforgot.php! Can someone
    > help me quickly, I'm on a tight deadline!
    >
    > Thanx
    > Phil
    >
    >[/color]


    Complete stab in the dark Phil.. is your <?php line on the very first
    line of the script? any blanks before that constitutes as data sent as
    the body.

    As for the other part, are register_global s enabled? Could try:


    $_SERVER['SERVER_NAME']



    Regards,

    Ian

    --
    Ian.H [Design & Development]
    digiServ Network - Web solutions
    www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
    Programming, Web design, development & hosting.

    Comment

    • Phil Powell

      #3
      Re: Header warnings??? Why??

      I am now the official idiot of the group.

      The very first line of the script is <?php

      However, this is how it was formatted:

      <?php

      // COMMENTS

      ?>

      <?
      // ACTUAL SCRIPT including "header"

      ?>

      Notice the space between the <? ?> blocks?

      Phil
      "Ian.H [dS]" <ian@WINDOZEdig iserv.net> wrote in message
      news:2003081522 0719.23d18bc8.i an@WINDOZEdigis erv.net...[color=blue]
      > On Fri, 15 Aug 2003 16:56:58 -0400 in
      > <message-id:NOb%a.2803$3 M4.744@lakeread 04>
      > "Phil Powell" <soazine@erols. com> wrote:
      >[color=green]
      > > // REDIRECT THEM BACK TO LOGIN
      > > if ($hasSubmittedU sername) {
      > > header("Locatio n: http://$SERVER_NAME/fslogin.php?err orMsg=" .
      > > urlencode($font . '<font color=000099><l i>Password
      > > emailed</li></font></font><p>') .
      > > '&username=' . urlencode($user name));
      > > }
      > >
      > > ?>
      > >
      > > <html>
      > > <head>
      > > <title><?= $brand ?> Login: Forgot Password</title>
      > >
      > > Based on this code snippet (and there is nothing being written to the
      > > headers prior to header("Locatio n.."), why am I getting the following:
      > >
      > > Warning: Cannot add header information - headers already sent by
      > > (output started at
      > > /home/youth/finesocceryouth sessions-www/fsforgot.php:15 )
      > > in/home/youth/finesocceryouth sessions-www/fsforgot.php on line 114
      > >
      > > The line is the header() line. Furthermore, instead of being
      > > redirected to fslogin.php I am still at fsforgot.php! Can someone
      > > help me quickly, I'm on a tight deadline!
      > >
      > > Thanx
      > > Phil
      > >
      > >[/color]
      >
      >
      > Complete stab in the dark Phil.. is your <?php line on the very first
      > line of the script? any blanks before that constitutes as data sent as
      > the body.
      >
      > As for the other part, are register_global s enabled? Could try:
      >
      >
      > $_SERVER['SERVER_NAME']
      >
      >
      >
      > Regards,
      >
      > Ian
      >
      > --
      > Ian.H [Design & Development]
      > digiServ Network - Web solutions
      > www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
      > Programming, Web design, development & hosting.[/color]


      Comment

      • Ian.H [dS]

        #4
        Re: Header warnings??? Why??

        On Fri, 15 Aug 2003 17:15:06 -0400 in
        <message-id:O3c%a.2918$3 M4.1040@lakerea d04>
        "Phil Powell" <soazine@erols. com> wrote:
        [color=blue]
        > I am now the official idiot of the group.
        >
        > The very first line of the script is <?php
        >
        > However, this is how it was formatted:
        >
        > <?php
        >
        > // COMMENTS
        >
        > ?>
        >
        > <?
        > // ACTUAL SCRIPT including "header"
        >
        > ?>
        >
        > Notice the space between the <? ?> blocks?[/color]


        Heh.. it happens Phil.

        A while back, I posted a snippet of code here, claiming that further up
        in the script (also pasted into the post) was identical to the part that
        wasn't working.... I forget who now, but it was pointed out I had missed
        a , or ; or something "silly"... but needless to say, the 2 snippets
        weren't quite as identical as I thought, lol.

        You also stated you're on a tight deadline.. this won't help as you'll
        have a tendency to overlook the more "silly / trivial" things, and
        probably look for a more complex problem that doesn't actually exist
        (yup, done that many a time too ;) ).

        Hope all's goin' well fr you now and you hit your deadline =)



        Regards,

        Ian

        --
        Ian.H [Design & Development]
        digiServ Network - Web solutions
        www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
        Programming, Web design, development & hosting.

        Comment

        • Richard

          #5
          Re: Header warnings??? Why??

          Phil Powell wrote:>>
          [color=blue]
          > // REDIRECT THEM BACK TO LOGIN
          > if ($hasSubmittedU sername) {
          > header("Locatio n: http://$SERVER_NAME/fslogin.php?err orMsg=" .
          > urlencode($font . '<font color=000099><l i>Password
          > emailed</li></font></font><p>') .
          > '&username=' . urlencode($user name));
          > }[/color]
          [color=blue]
          > ?>[/color]
          [color=blue]
          > <html>
          > <head>
          > <title><?= $brand ?> Login: Forgot Password</title>[/color]
          [color=blue]
          > Based on this code snippet (and there is nothing being written to the
          > headers prior to header("Locatio n.."), why am I getting the following:[/color]
          [color=blue]
          > Warning: Cannot add header information - headers already sent by (output
          > started at /home/youth/finesocceryouth sessions-www/fsforgot.php:15 ) in
          > /home/youth/finesocceryouth sessions-www/fsforgot.php on line 114[/color]
          [color=blue]
          > The line is the header() line. Furthermore, instead of being redirected
          > to fslogin.php I am still at fsforgot.php! Can someone help me quickly,
          > I'm on a tight deadline![/color]
          [color=blue]
          > Thanx
          > Phil[/color]

          Might have a nested tag open somewhere.
          I was encountering a similar problem with some coding and when I had enough
          close tags, the error went away.
          The process continues working it's way down the ladder until it receives an
          end point.
          If no end point is reached and it passes through more coding, you get the
          error.
          Which happens a lot in javascript when you have script below the body of the
          html. The process runs over into the lower coding and encounters the error.



          Comment

          Working...