The prefered 'login' procedure and redirect.

From: Simon (spambucket_at_myoddweb.com)
Date: 03/24/05


Date: Thu, 24 Mar 2005 06:56:25 -0000

Hi,

I have a Login.php page that logs the user in and out.
I has two forms within the page, (depending on what we are trying to do),
either one to log in or out.

The form calls itself using a post method and either logs the user in our
out given the information from the form.
but every pages use sessions and cookies, if the user is successfully logged
in then the cookies and session values are updated, (as well as MySQL).

Now it all works fine but I want to add some functionality where if the user
goes to a restricted page they are sent to the login page, and if the login
is successful then they will be sent back to the original restricted page.

I can redirect the user from the restricted page to the login page, but
returning to the restricted page after login is a problem as the headers
have been sent already, (to do the login).
Because the login uses sessions/cookies and tables I have to send the
headers to do the login as I cannot login the user and then redirect them to
a page, (the redirect must be before sessions/cookies I believe.

So what is the 'preferred way to redirect users after a successful login?

Simon



Relevant Pages

  • The prefered login procedure and redirect.
    ... I have a Login.php page that logs the user in and out. ... goes to a restricted page they are sent to the login page, ... Because the login uses sessions/cookies and tables I have to send the ... headers to do the login as I cannot login the user and then redirect them to ...
    (comp.lang.php)
  • Re: Auto Populating Blocked IPs List
    ... I just checked my security logs - which I save - and I see ... The earlies attacks were trying to almost invariably login as ... >IP blocks their ISP is handing out and allow only those. ... Bill Vermillion - bv @ wjv. ...
    (comp.unix.bsd.freebsd.misc)
  • Re: The prefered login procedure and redirect.
    ... > I have a Login.php page that logs the user in and out. ... > goes to a restricted page they are sent to the login page, ... > headers to do the login as I cannot login the user and then redirect them ... Redirect can happens after the session is set, ...
    (alt.php)
  • Re: The prefered login procedure and redirect.
    ... > I have a Login.php page that logs the user in and out. ... > goes to a restricted page they are sent to the login page, ... > headers to do the login as I cannot login the user and then redirect them ... Redirect can happens after the session is set, ...
    (comp.lang.php)
  • Re: Last Login
    ... The table "tblLastLogin" gets updated when ... intCount gets successfully populated with the number of stories since last ... login but intLastLogin does not get updated, ... If it gets updated as soon as the publisher logs in, ...
    (microsoft.public.access.queries)