Re: Setcookie()
| From: | Per Jessen | Date: | Sat, 11 Oct 2008 16:33:07 +0000 |
| Subject: | Re: Setcookie() | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281717@lists.php.net to get a copy of this message | ||
Ben Stones wrote:
> What I mean is I cannot use setcookie, I need to check if user
> credentials are correct first (which is BEFORE setcookie) and if so,
> set a cookie. I can't do that unless setcookie is first, but I need to
> check if the user credentials is correct. Furthermore I cannot use
> setcookie in the header as I want to display a message saying that
> they have successfully logged in in the correct area of my template.
Well, I'm doing exactly that and it works just fine. This is a rough
outline of the flow:
GET <login page> (form with user and password fields)
POST <login page>
validate user+password, save in session
setcookie().
redirect with 303 to <welcome page>
GET <welcome page>
/Per Jessen, Zürich