File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 99
1010require_once (dirname (__FILE__ ).'/i18n.php ' );
1111
12+
13+ // Saving user IPs to the session for preventing session hijacking
14+ $ user_combined_ip = $ _SERVER ['REMOTE_ADDR ' ] .'| ' . $ _SERVER ['HTTP_CLIENT_IP ' ] .'| ' . $ _SERVER ['HTTP_X_FORWARDED_FOR ' ] .'| ' . $ _SERVER ['HTTP_X_FORWARDED ' ] .'| ' . $ _SERVER ['HTTP_FORWARDED_FOR ' ] .'| ' . $ _SERVER ['HTTP_FORWARDED ' ];
15+
16+ if (!isset ($ _SESSION ['user_combined_ip ' ])){
17+ $ _SESSION ['user_combined_ip ' ] = $ user_combined_ip ;
18+ }
19+
20+ // Checking user to use session from the same IP he has been logged in
21+ if ($ _SESSION ['user_combined_ip ' ] != $ user_combined_ip ){
22+ session_destroy ();
23+ $ _SESSION ['request_uri ' ] = $ _SERVER ['REQUEST_URI ' ];
24+ header ("Location: /login/ " );
25+ exit ;
26+ }
27+
1228// Check system settings
1329if ((!isset ($ _SESSION ['VERSION ' ])) && (!defined ('NO_AUTH_REQUIRED ' ))) {
1430 session_destroy ();
You can’t perform that action at this time.
0 commit comments