
January 13th, 2000, 06:40 AM
|
|
Apprentice Deity
|
|
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237

Time spent in forums: 4 m 8 sec
Reputation Power: 17
|
|
|
Cookies are fine if the user doesn't have them disabled.
All you need to do is create a session identifier that can be passed from page to page, via POST, GET or cookie. Using md5() hashes is about as secure as you can get. When you process the login, you can create a unique session id by using this:
$session=md5(uniqid($uname));
where $uname is the users name. Store this info along with the users id, name or whatever and a timestamp in a table or flat file. Pass $session from page to page and at the top of each page verify that $session is valid in the table and that the current time is not too long since the timestamp was updated. If it is you can have them log in again. If not, update the timestamp to the current time and display the page.
Often, for added security, you can use the IP address of the visitor to make sure no one is using the same current session id. Beware, people connecting via proxies can have IPs that change between page views, however, it is unlikely that the IP will change outside of the lowest level (e.g. in the IP 111.222.33.44, 111.222.33 should remain constant). So you could check only those portions of the IP.
|