Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HELP: How To Keep User Logged In Even When Browser Is Been Closed Using Php
#1
Please, I need help on how to keep users logged in on my website even when the browser is closed. I checked multiple time on Google on how to achieve that; most atimes they mention 'COOKIE'. am current using session variable..... Please help!!!

@dealwap @deelino and all the Bosses.....
#2
Not a php coder but I think "session" expires when user logs out of the browser and "cookies" are used to keep user logged in.
Useful for autologin...
php coders am I talking?
Reply
#3
you can add this to the login form

ini_set( 'session.cookie_lifetime' , 60 * 60 *
24 * 365);
ini_set( 'session.gc-maxlifetime' , 60 * 60 *
24 * 365);
session_start();

it sets it to a year, it gets destroyed after, but this is not the most secure way
I am a proud member of NIgerian Coders Team
Reply
#4
(08-26-2019, 09:07 AM)Nostory Wrote:
you can add this to the login form

ini_set( 'session.cookie_lifetime' , 60 * 60 *
24 * 365);
ini_set( 'session.gc-maxlifetime' , 60 * 60 *
24 * 365);
session_start();

it sets it to a year, it gets destroyed after, but this is not the most secure way

Thanks, Boss
I will try this and see.....
Reply
#5
I was able to work it out using cookie.......
setcookie help to set the cookie
setcookie(name, value, expire, path, domain, secure, httponly);
While, We retrieve the value of the cookie name (using the global variable $_COOKIE).
[-] The following 1 user Likes Gbutemu11's post:
  • dealwap
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  HELP: How To Keep User Logged In When Current Username Is Changed With Form Using Php Aaron 15 815 08-31-2018, 08:11 PM
Last Post: Aaron
  HELP: How To Redirect Desktop Users To Another Page Using User-agent Aaron 8 671 11-21-2017, 05:06 AM
Last Post: baloguns60
  HELP: How To Keep User Logged In Even When Browser/Tab Is Been Closed Using Php Aaron 31 1,313 10-15-2017, 09:25 PM
Last Post: Aaron
  HELP: How To Create A User Profile Photo Upload System Using Php Aaron 2 479 08-19-2017, 09:08 PM
Last Post: Aaron



Users browsing this thread: 1 Guest(s)

About Nigeria's Creative Talents

Nigeria's Creative Talents is an online community where every creative Nigerians can share ideas with themselves.

For any more information, please use our contact form.

              User Links

              Advertise