开发者

PHP Session handling

I have a PHP and MySQL web app with a users table, I would like to make sure only one user is logged into the system with each username and password combination.

I'm looking for pointers on the best way to handle their sessions,

1) Store the session key and the last time it was used next to the username in the db

2)开发者_开发问答 Put the last logged in date in a cookie

3) session_name()?

Thanks in advance


Create a new table with the user id as a foreign key along with the session id. When a new user logs in check whether the id exists in the table already. When the user logs out make sure you remove delete the record from the new table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜