loggout.php fails to properly redirect

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

    loggout.php fails to properly redirect

    loggout.php doesn't exactly redirect properly, and I have no idea what to do
    about it... I need to bust out of the frame and go to top, so, how do I do
    it?

    Code that I have that fails:

    <?


    require_once('/home/nordicnet.no/include/nordicnet_globa l_vars_function s.php
    ');

    setcookie('nord icnet_registrat ion', 0, time() - 86400, '/'); // DELETE
    COOKIE

    ?>

    <html>
    <head>
    <meta http-equiv=Refresh content="0;URL= http://<?= $serverName
    ?>/index.php">
    <script>
    <!--
    location.target = top;
    location.href = 'http://<?= $serverName ?>/index.php';
    //-->
    </script>
    </head>
    <body>
    <?= $font ?>Om du er her <a href=http://<?= $serverName ?>/index.php>klikk
    her</a></font>
    </body>
    </html>

    Phil


  • Janwillem Borleffs

    #2
    Re: loggout.php fails to properly redirect


    "Phil Powell" <soazine@erols. com> schreef in bericht
    news:U5s6b.1269 43$xf.100813@la keread04...[color=blue]
    > loggout.php doesn't exactly redirect properly, and I have no idea what to[/color]
    do[color=blue]
    > about it... I need to bust out of the frame and go to top, so, how do I do
    > it?
    >
    > Code that I have that fails:
    >[/color]

    The following should work without the JavaScript:

    <?
    require_once('/path/to/nordicnet_globa l_vars_function s.php');
    setcookie('nord icnet_registrat ion', 0, time() - 86400, '/');
    header("Locatio n: http://$serverName/index.php");
    ?>


    JW



    Comment

    • Pedro

      #3
      Re: loggout.php fails to properly redirect

      [not croosposted to alt.php, comp.lang.javas cript]

      Phil Powell wrote:[color=blue]
      >loggout.php doesn't exactly redirect properly, and I have no idea what to do
      >about it... I need to bust out of the frame and go to top, so, how do I do
      >it?
      >
      >Code that I have that fails:
      >
      ><?
      >
      >
      >require_once ('/home/nordicnet.no/include/nordicnet_globa l_vars_function s.php
      >');
      >
      > setcookie('nord icnet_registrat ion', 0, time() - 86400, '/'); // DELETE
      >COOKIE
      >
      >?>
      >
      ><html>
      ><head>
      ><meta http-equiv=Refresh content="0;URL= http://<?= $serverName
      >?>/index.php">
      ><script>
      ><!--
      > location.target = top;
      > location.href = 'http://<?= $serverName ?>/index.php';
      >//-->
      ></script>
      ></head>
      ><body>
      ><?= $font ?>Om du er her <a href=http://<?= $serverName ?>/index.php>klikk
      >her</a></font>
      ></body>
      ></html>
      >
      >Phil
      >[/color]

      I'd do it differently

      1. the logout link:
      <a href="..../logout.php" target="_top">l ogout</a>

      2. logout.php
      <?php
      ### clear cookies
      ### update database
      ### whatever else you need
      header('Locatio n: /index.php'); ### should also have server
      exit('Redirecte d to the <a href="/index.php">home page</a>.');
      ?>



      --
      "Yes, I'm positive."
      "Are you sure?"
      "Help, somebody has stolen one of my electrons!"
      Two atoms are talking:

      Comment

      • Phil Powell

        #4
        Re: loggout.php fails to properly redirect

        It does work, except that index.php opens up within the frame of
        Palogget%20S1.p hp and not on _top, which is what I need for it to do.

        Phil

        "Janwillem Borleffs" <jwb@jwbfoto.de mon.nl> wrote in message
        news:3f5a538f$0 $28899$1b62eedf @news.euronet.n l...[color=blue]
        >
        > "Phil Powell" <soazine@erols. com> schreef in bericht
        > news:U5s6b.1269 43$xf.100813@la keread04...[color=green]
        > > loggout.php doesn't exactly redirect properly, and I have no idea what[/color][/color]
        to[color=blue]
        > do[color=green]
        > > about it... I need to bust out of the frame and go to top, so, how do I[/color][/color]
        do[color=blue][color=green]
        > > it?
        > >
        > > Code that I have that fails:
        > >[/color]
        >
        > The following should work without the JavaScript:
        >
        > <?
        > require_once('/path/to/nordicnet_globa l_vars_function s.php');
        > setcookie('nord icnet_registrat ion', 0, time() - 86400, '/');
        > header("Locatio n: http://$serverName/index.php");
        > ?>
        >
        >
        > JW
        >
        >
        >[/color]


        Comment

        • Janwillem Borleffs

          #5
          Re: loggout.php fails to properly redirect


          "Phil Powell" <soazine@erols. com> schreef in bericht
          news:JIs6b.1269 62$xf.41022@lak eread04...[color=blue]
          > It does work, except that index.php opens up within the frame of
          > Palogget%20S1.p hp and not on _top, which is what I need for it to do.
          >[/color]

          Don't you just hate frames? This calls for the dirty approach:

          <?
          require_once('/path/to/nordicnet_globa l_vars_function s.php');
          setcookie('nord icnet_registrat ion', 0, time() - 86400, '/');
          ?>
          <html>
          <head>
          <script>top.loc ation='http://<?=$serverName? >/index.php';</script>
          </head>
          <body>
          <noscript>
          Please click <a href="http://<?=$serverName? >/index.php"
          target="_top">h ere</a>
          To continue
          </noscript>
          </body>
          </html>


          JW



          Comment

          • Phil Powell

            #6
            Re: loggout.php fails to properly redirect

            OUCH! I forgot all about that!!!

            window.parent.l ocation.href = ....

            That does the trick! Thanx
            Phil

            "Janwillem Borleffs" <jwb@jwbfoto.de mon.nl> wrote in message
            news:3f5a5967$0 $28898$1b62eedf @news.euronet.n l...[color=blue]
            >
            > "Phil Powell" <soazine@erols. com> schreef in bericht
            > news:JIs6b.1269 62$xf.41022@lak eread04...[color=green]
            > > It does work, except that index.php opens up within the frame of
            > > Palogget%20S1.p hp and not on _top, which is what I need for it to do.
            > >[/color]
            >
            > Don't you just hate frames? This calls for the dirty approach:
            >
            > <?
            > require_once('/path/to/nordicnet_globa l_vars_function s.php');
            > setcookie('nord icnet_registrat ion', 0, time() - 86400, '/');
            > ?>
            > <html>
            > <head>
            > <script>top.loc ation='http://<?=$serverName? >/index.php';</script>
            > </head>
            > <body>
            > <noscript>
            > Please click <a href="http://<?=$serverName? >/index.php"
            > target="_top">h ere</a>
            > To continue
            > </noscript>
            > </body>
            > </html>
            >
            >
            > JW
            >
            >
            >[/color]


            Comment

            Working...