I worked in Codeigniter . I want to logged out a user from all browser when he change his current password. I Want to destroy all session of the user.
Asked
Active
Viewed 970 times
0
-
[Use php's session_destroy() example](http://www.php.net/manual/en/function.session-destroy.php). Even CI docs say to use it. – ourmandave Jan 31 '17 at 18:52
-
no that's not gonna work because i am using db base session – user6542291 Jan 31 '17 at 19:52
-
[I found this answer about CI's automatic db sessions clean up](http://stackoverflow.com/a/36836530/3585500). Once you call session_destroy() CI gens a new session id and you'll never reference the old session record again. – ourmandave Feb 01 '17 at 12:08
1 Answers
0
There are a few ways you can achieve this, one would be having a random string inside the table for sessions, check this key on every http request made by the user, when they change the password you alter the key, and it would not match the users key anymore. When this happens you just manually log them out. One way of implementing this can be by using CodeIgniter hooks.
killstreet
- 1,251
- 2
- 15
- 37