is it possible to have more than one header(location: );

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fruityfreak
    New Member
    • Jun 2007
    • 24

    is it possible to have more than one header(location: );

    is it possible to have more than one header(location : );

    or can i have one
    header('Refresh : 3; url=login.php') ;
    and
    echo header('locatio n: index.php');
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, fruityfreak.

    To do that, redirect to login.php?targe t=index.php, and then have login.php redirect to $_GET['target'].

    Comment

    • fruityfreak
      New Member
      • Jun 2007
      • 24

      #3
      what do u mean by that??

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, fruityfreak.

        Originally posted by fruityfreak
        what do u mean by that??
        In other words, if you wanted to (I'm assuming) log the User out, you could do this:

        [code=php]
        header('Locatio n: login.php?targe t=index.php');
        exit();
        [/code]

        Which would pass 'index.php' as the value of $_GET['target'] to login.php.

        And then at the bottom of login.php:
        [code=php]
        if(! empty($_GET['target']))
        {
        header('Locatio n: ' . $_GET['target']);
        }
        else
        {
        header('Locatio n: someDefaultLoca tion.ext');
        }
        exit();
        [/code]

        Comment

        • kovik
          Recognized Expert Top Contributor
          • Jun 2007
          • 1044

          #5
          With absolute URLs as the Location header directive. ;)

          Comment

          Working...