The reason for the base64 was to clean up the url string a little.
Otherwise, if they have a link very deep into that site they don't have
an extremely long url.  But, you're right - it probably is overkill.

Secondly, as Piet just pointed out, HTTP_REFERER is controlled by the
browser and it can be changed.  I believe Opera (and possibly FireFox)
have options to turn off the referrer, so this is not a solution for
100% of the users out there. 

Conor 


-----Original Message-----
From: Paul Menard [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 07, 2005 9:43 AM
To: [email protected]
Subject: Re: [php-list] Back to original page after login


Um. I'm not really sure I ever saw the original message. But I have read
through the two posts
this morning and can say they really seem like overkill. I mean base-64
encoding the original URL
and passing it as a variable seems very convoluted (sorry no slam to the
posted meant).

The best solution is to capture the HTTP_REFERER value in the login
page. This is passed
automatically and cannot be controlled. 

My thoughts. Some times the easiest answers are the best.

Paul






--- Patrick Bierans <[EMAIL PROTECTED]> wrote:
> > I'm working in my first site using authentication and sessions.
Users
> > can log in from any page on the site.
> >
> > However...when a user logs in, how do I direct them back to the page
> > they were viewing? This would include the variables that are passed
to
> > the MySQL database.
> >
> > Is there a way to look back in the browser history a couple of
pages?
> 
> Yes: javascript and history.go() but don't!
> 
> On redirect pass the url the user wanted to open and use header() to 
> redirect to it on successful login.
> For example:
> 
> <?php // index.php?page=something
>   header('location: login.php?nextpage='.$page');
> ?>
> 
> <?php // login.php
>   session_start();
>   if (user_logged_in($formdata))
>     header('location: index.php?page='.$nextpage'&'.SID);
> ?>
> 
> But take a look at my application structure example. It shows you a 
> different technique which is much more simple.
> http://bierans.de/shared 
> 
> 


Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links



 






Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to