Jump to content

'Remember Me' form feature


Schlo_50

Recommended Posts

Hi there,

 

Im after a guide or snippet of code that will help give me an idea how to create add the 'remeber me' feature to my login form. I'd ideally like to do this without the use of a mysql database, which sadly most of the tutorials I have looked for on Google use.

 

I just need the remember me feature to automatically sign in people when they visit my page. The page will only be used by 3 or 4 people, so there won't be hundred of users data/ip's to remember or anything.

 

Can this be done?

Any help welcomed!

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/103545-remember-me-form-feature/
Share on other sites

Since you are already suing a login system, you may already be using a cookie?

Just prolong the expiration time of the cookie.

 

eg:

Instead of

setcookie("username","Schlo_50");
//this will set a cookie which will expire as soon as the browser is closed

 

use :

$cookie_life_span=time()+(60*60)//current time+(60 mins* 60 sec) =set a cookie that will expire after 1 hr.
setcookie("username","Schlo_50",$cookie_life_span);
//this will set a cookie which will expire as soon as the browser is closed

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.