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
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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.