PHP Rembering Login
Moderator: General Moderators
PHP Rembering Login
hi how can i make a login that rembers the username.
i have currently got it as a cookie but gamers can delete the cookie and the timer is ended.
is sesions the same as cookies
please help thanks reece
i have currently got it as a cookie but gamers can delete the cookie and the timer is ended.
is sesions the same as cookies
please help thanks reece
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You can't, you can have the control of your server and for the output being sent to the user's browser, but you can never have control on the user's computer.
You can set the lifetime of the session, but when the user closes the browser then the session expires - no matter what.
You may want to check: http://us2.php.net/manual/en/function.s ... params.php
You can set the lifetime of the session, but when the user closes the browser then the session expires - no matter what.
You may want to check: http://us2.php.net/manual/en/function.s ... params.php
Re: hi
A couple of reasons ( assuming the game was browser based ):reecec wrote: how come i have tried some games and i delete the cookies close the browser and im still loged in
- You didn't close all the browser windows
- You didn't delete the right cookie
- The browser just auto filled the login form and you clicked login without knowing.
- Some sort of evil dark magic.
Re: hi
I vote for option 4...PrObLeM wrote: - You didn't close all the browser windows
- You didn't delete the right cookie
- The browser just auto filled the login form and you clicked login without knowing.
- Some sort of evil dark magic.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
This is not exactly true.Oren wrote:There is nothing you can do, if one deletes the cookie he would have to log in again.
No, a session is not like a cookie. Once the browser is closed - the session doesn't exist any longer.
If you delete the cookie, but are using sessions, you can pass the session ID via the request to maintain the session.
Likewise, if there is a session cookie set, you can close the browser and reopen it and the session is maintained.
(#10850)
Well... arborint is also right - it all depends on the case. Personally, I use only session cookies. I use an .htaccess file with this code in it:
Now, the default PHP value for the cookie lifetime is '0' = 'until the browser is closed'. So, in general, the session expires when the browser is closed as I said before, but if for some reason the cookie lifetime is set to something else, then the session wouldn't expire once the broswer is closed - in this case arborint is right 
Code: Select all
php_value session.use_cookies 1
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0