source: branches/2.4/prototype/api/esecurity.php @ 6829

Revision 6829, 771 bytes checked in by eduardow, 12 years ago (diff)

Ticket #2967 - Melhoria na sessão do usuário do expresso.

Line 
1<?php
2
3require_once(__DIR__.'/controller.php');
4
5class ESecurity
6{
7   public function valid()
8   {
9        if(isset($_SESSION['wallet']['security']['REMOTE_ADDR']))
10        {
11            if($_SESSION['wallet']['security']['REMOTE_ADDR'] !== $_SERVER['REMOTE_ADDR'])
12            {
13                $sql = 'SELECT config_value FROM phpgw_config WHERE config_app = \'phpgwapi\' AND config_name = \'webserver_url\'';
14                $params = Controller::service('PostgreSQL')->execResultSql($sql);
15                session_destroy();
16                header( 'Location: '.$params[0]['config_value'].'/login.php' );
17                die();
18            }
19        }
20        else
21            $_SESSION['wallet']['security']['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
22   }
23   
24}
25?>
Note: See TracBrowser for help on using the repository browser.