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.


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

<?
$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 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.


CHeers,

Justin


on 19/01/03 3:03 AM, -<[ Rene Brehmer ]>- ([EMAIL PROTECTED]) wrote:

> Hi gang
> 
> Been trying to figure out this session stuff, but since I was unable to
> make the manual sample into something workable, I instead decided to
> actually try and make the session do what I need it for: Passing the URL
> of the caller page to the page that's being called.
> 
> 1. Only I can't figure out if there's a function to just pull the current
> URL and plop it into a session variable. The thing is that these pages are
> all built by using a bunch of GET variables in the URL, so it would be
> easiest to just do something like:
> 
> $_SESSION['mother'] = $currentURL;
> 
> And then in the called, daughter, page do this:
> 
> <a href=<?php echo("\"$_SESSION['mother']\"") ?>>Get back to where you
> came from</a>
> 
> As the only other way I've found is to have it use the string-functions
> and re-build the current URL throughout the if-tree that builds the page.
> I need to pass the mother URL to the daughter pages because there's two
> main entry-points into the daugther pages, and one of them can have 10-15
> different states...
> 
> But how do you pull the current url? ParseURL just smacks it into an
> array, and I'll then have to rebuild it anyway ... which makes it about
> just as simple as running it through the if-tree. Whether or not the
> session-id is inside the URL is not essential to me, but dunno if php
> cares about it.
> 
> 2. Since the above is required to function at all times, I need to
> override the expiration time. I can't do it in the ini file, 'cause I
> can't modify the server where it's to run, and it's set to 0 there... (not
> sure if that means it expires right away, or not at all)
> 
> Anyway to do this???
> 
> TIA
> 
> Rene


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

Reply via email to