Hi Justin French,

On Sun, 19 Jan 2003 12:01:45 +1100, you wrote about "Re: [PHP] 2 Qs:
Passing current URL with session and how to avoid session timeout???"
something that looked like this:

>1. If you require the back button to work forever, then do not use sessions,
>because they're not designed to be a forever thing.

I only need the session to pass the url on to the next page ... once there
the old URL will be written into the HTML code... The only reasons I need
to do it with sessions is because my urls are too long for the encoded url
to be transfered reliably within the url...

>2. I do this sort of stuff by building my own URL from $_SERVER components:

I haven't found the server array in the manual (yet anyway), so I'm not
sure what exactly it is you're doing ... so a bit of 'splaining would be
nice ... I'm only on my 4th month of PHP'ing afterall ... 

><?
>$script = $_SERVER['PHP_SELF'];
>$qs = $_SERVER['QUERY_STRING'];
>$currentURL = base64_encode($script."?".$qs);
>?>
>
>The reason why I base64_encode() it is so that the vars=values of the
>previous page don't affect the next page.

I don't have that problem. Variables aren't reausable because I'm doing
divide and conquer design ... that way I can prevent the code from being
too complex and requiring to many variables to work. Thus my variables
differ from master page to master page, all the common ones are rewritten
on each page load (as it only controls the menu links to be linked
correctly up/down folder levels).

>I the link to the second page might be something like:
>
><a href="page.php?ref=<?=$currentURL?>">click</a>
>
>on page.php, to establish a back button:
>
><? $ref = base64_decode($ref) ?>
><a href="<?=$ref?>">go back</a>
>
>3.  This way, the referring/mother URL is always attached to that URL... if
>they bookmark it, of give it to a friend, it's always there... sessions
>don't achieve this, and cookies usually can, apart from the usual cookie
>problems.

Apparently the trans_sid being on (or 1 as it is) makes the sid transfer
correctly everytime, atleast with my current setup ... which is this:

On mother:

  $_SESSION['mother'] = "girlz.php?locat=$loc&list=$list&year=$year";

On child:
  
        if ($name != "") {
          $backlink = "<div align=\"center\"><a
href=\"".$_SESSION['mother']."\" class=\"bldlink\" title=\"Get back to
where you came from\">Back to where you came from</a></div><br />";
          echo($backlink);
        }

And before you ask, the reason the backlink is in a variable is because
it's reused a couple times down the page.

The above is, of course, only part of the code. It checks for alot more
stuff in the child file. Still have to work out how to ensure that the
backlink will produce a workable return link even when the page is
launched without a call from a mother page...

But that'll have to wait until morning ... it's 4.45 AM here now ;-) ...
gotta get some snooze...

Rene

-- 
Rene Brehmer

This message was written on 100% recycled spam.

Come see! My brand new site is now online!
http://www.metalbunny.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to