WA
08-10-2002, 09:34 AM
I'm reading up on sessions and cookies in PHP, and am a little confused on the usage between the two.
For example, lets say I want to create a typical username/password login form to allow visitors to login and browse the rest of the site, with the option to "remember login info permanantly." For the later part, what is the most common way of implementing such a feature? Is it to
1) Store the name/password set on the user's computer using permanant cookies during their initial log-in, then upon their return, retrieve and set this info as session variables each time
2) Or is there a way for PHP sessions alone to handle the entire process without resorting to cookies? I read how one could session_encode() a session, then store the info on the server, though how would this info then be matched up with each member that returns to the site?
From a novice point of view, it would seem implementing a "remember user login permanantly" feature can only be acomplished using 1).
Thanks for any insight.
For example, lets say I want to create a typical username/password login form to allow visitors to login and browse the rest of the site, with the option to "remember login info permanantly." For the later part, what is the most common way of implementing such a feature? Is it to
1) Store the name/password set on the user's computer using permanant cookies during their initial log-in, then upon their return, retrieve and set this info as session variables each time
2) Or is there a way for PHP sessions alone to handle the entire process without resorting to cookies? I read how one could session_encode() a session, then store the info on the server, though how would this info then be matched up with each member that returns to the site?
From a novice point of view, it would seem implementing a "remember user login permanantly" feature can only be acomplished using 1).
Thanks for any insight.