|
Posted by Martin on 11/03/05 01:49
Nevermind... I got it working - it had nothing to do with the code
shown below.
Thanks anyway.
On Wed, 02 Nov 2005 13:19:01 -0700, Martin <martinvalley@comcast.net>
wrote:
>OK, need some more help here. I cannot get this thing to write the
>cookie.
>
>Obviously, I want to write the cookie only after the user has
>successfully logged-in. So, after I've validated the user, I'm setting
>the cookie and re-directing him to the home page.
>
>But the cookie does NOT get set - what am I doing wrong?
>
>
>Here's the part of LogIn.PHP that doing this ("user_login" is a script
>in an include file (which, BTW, sets a couple of cookies itself!))
>
>
>if ($_POST['submit'] == 'Log In') {
>
> if (strlen($_POST['username']) <= 25 && strlen($_POST['password'])
><=25) {
> $feedback = user_login();
> } else {
> $feedback = 'ERROR - Invalid User Name and/or password.';
> }
>
> if ($feedback == 1)
> {
> setcookie("userid",$_POST["username"],time()+31536000);
> header("Location: home_page.php");
> }
> else
> {
> $feedback_str = "<P class=\"errormess\">$feedback</P>";
> }
>
>}
>else
>{
> $feedback_str = '';
>}
>
>
>On Wed, 02 Nov 2005 08:02:22 -0700, Martin <martinvalley@comcast.net>
>wrote:
>
>>I would like to give a registered user of my website the option to
>>save his user id on his computer such that it will be pre-entered the
>>next time he goes to the log-in page.
>>
>>It's my understanding that to do this I would write the information to
>>a cookie (after he successfully logs in with the option checked). What
>>I'm not clear on is, how do I get the userid from the cookie into the
>>text box on the log-in page? Do I read the cookie when he "hits" the
>>log-in page and then load the text box before I send out the page?
>>
>>Can someone point me to some sample code for this?
>>
>>Thanks.
Navigation:
[Reply to this message]
|