redirect after auto script

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

    redirect after auto script

    I have a page 'pni.php' to which paypal is redirecting after payment
    thsi page contains a db update script, no problem it's running well

    but once this script is executed (transparently for the use, as there
    is nothing to display)
    how can I redirect to another page ?

    header redirect can only be placed at the beginning of the page... not
    at the end
    I've already writen redirection but only when there was a form inside
    and a user action.. to refresh the page , this is not the case ... :-((

    pni.php
    <?
    DN update script from Paypal _POST data
    ....
    (no display, no user action)
    ...
    auto redirect to another page ? -> index.php
    ?>

  • samudasu

    #2
    Re: redirect after auto script

    You "can" make a call to header() at the end of the page as long as
    there's been no output to the broswer. If you're using include() or
    require(), make sure there's no newlines or extra spaces in the update
    script or else the call to header() will fail.

    Comment

    • Jasen Betts

      #3
      Re: redirect after auto script

      On 2006-02-17, Josselin <josselin@wanad oo.fr> wrote:[color=blue]
      > I have a page 'pni.php' to which paypal is redirecting after payment
      > thsi page contains a db update script, no problem it's running well
      >
      > but once this script is executed (transparently for the use, as there
      > is nothing to display)
      > how can I redirect to another page ?
      >
      > header redirect can only be placed at the beginning of the page... not
      > at the end
      > I've already writen redirection but only when there was a form inside
      > and a user action.. to refresh the page , this is not the case ... :-(([/color]

      headers must come before any emitted content.
      but needn't come at the start of the script.

      if the script produces no output you can put the header() call anywhere.
      [color=blue]
      > pni.php
      ><?
      > DN update script from Paypal _POST data
      > ...
      > (no display, no user action)
      > ..
      > auto redirect to another page ? -> index.php
      > ?>[/color]

      you can put the header at either end of the script. it makes no difference
      as long as it has no produced content before it.

      Bye.
      Jasen

      Comment

      • Yves

        #4
        Re: redirect after auto script

        On 2006-02-18 09:09:05 +0100, Jasen Betts <jasen@free.net .nz> said:
        [color=blue]
        > On 2006-02-17, Josselin <josselin@wanad oo.fr> wrote:[color=green]
        >> I have a page 'pni.php' to which paypal is redirecting after payment
        >> thsi page contains a db update script, no problem it's running well
        >>
        >> but once this script is executed (transparently for the use, as there
        >> is nothing to display)
        >> how can I redirect to another page ?
        >>
        >> header redirect can only be placed at the beginning of the page... not
        >> at the end
        >> I've already writen redirection but only when there was a form inside
        >> and a user action.. to refresh the page , this is not the case ... :-(([/color]
        >
        > headers must come before any emitted content.
        > but needn't come at the start of the script.
        >
        > if the script produces no output you can put the header() call anywhere.
        >[color=green]
        >> pni.php
        >> <?
        >> DN update script from Paypal _POST data
        >> ...
        >> (no display, no user action)
        >> ..
        >> auto redirect to another page ? -> index.php
        >> ?>[/color]
        >
        > you can put the header at either end of the script. it makes no difference
        > as long as it has no produced content before it.
        >
        > Bye.
        > Jasen[/color]

        Thanks for you answers ... after a good rest, I discovered that I put
        it in the wrong included files ...

        pni.php includes pni_succes.php end include pni_error.php
        the redirect MUST be writtent at the end of the pni_php !!!


        Comment

        • Yves

          #5
          Re: redirect after auto script

          On 2006-02-18 05:11:13 +0100, "samudasu" <samudasu@hotma il.com> said:
          [color=blue]
          > You "can" make a call to header() at the end of the page as long as
          > there's been no output to the broswer. If you're using include() or
          > require(), make sure there's no newlines or extra spaces in the update
          > script or else the call to header() will fail.[/color]

          Thanks for you answers ... after a good rest, I discovered that I put
          it in the wrong included files ...

          pni.php includes pni_succes.php end include pni_error.php
          the redirect MUST be writtent at the end of the pni_php !!!

          Comment

          • Roco3D

            #6
            Re: redirect after auto script

            <meta http-equiv="refresh" content="x;url= ./index.php" />

            Where x is number of seconds before redirect
            put it into the header of you page. And put some link that the user can
            follow if the redirect does not work

            Comment

            Working...