Revision 6852,
1.5 KB
checked in by eduardow, 12 years ago
(diff) |
Ticket #2967 - Melhoria na sessão do usuário do expresso - Nome de classe em conflito.
|
Rev | Line | |
---|
[6829] | 1 | <?php |
---|
| 2 | |
---|
[6852] | 3 | require_once(__DIR__.'/config.php'); |
---|
[6829] | 4 | |
---|
[6852] | 5 | use prototype\api\Config as Config; |
---|
| 6 | |
---|
[6829] | 7 | class ESecurity |
---|
| 8 | { |
---|
| 9 | public function valid() |
---|
| 10 | { |
---|
| 11 | if(isset($_SESSION['wallet']['security']['REMOTE_ADDR'])) |
---|
| 12 | { |
---|
| 13 | if($_SESSION['wallet']['security']['REMOTE_ADDR'] !== $_SERVER['REMOTE_ADDR']) |
---|
| 14 | { |
---|
| 15 | $sql = 'SELECT config_value FROM phpgw_config WHERE config_app = \'phpgwapi\' AND config_name = \'webserver_url\''; |
---|
[6852] | 16 | $config = Config::service('PostgreSQL' , 'config'); |
---|
| 17 | |
---|
| 18 | $rs = ''; |
---|
| 19 | $rs .= ( isset($config['host']) && $config['host'] ) ? ' host='.$config['host'] : '' ; |
---|
| 20 | $rs .= ( isset($config['user']) && $config['user'] ) ? ' user='.$config['user'] : '' ; |
---|
| 21 | $rs .= ( isset($config['password']) && $config['password'] ) ? ' password='.$config['password'] : '' ; |
---|
| 22 | $rs .= ( isset($config['dbname']) && $config['dbname'] ) ? ' dbname='.$config['dbname'] : '' ; |
---|
| 23 | $rs .= ( isset($config['port']) && $config['port'] ) ? ' port='.$config['port'] : '' ; |
---|
| 24 | |
---|
| 25 | $con = pg_connect( $rs ); |
---|
| 26 | $rs = pg_query( $con, $sql ); |
---|
| 27 | $row = pg_fetch_assoc( $rs ); |
---|
| 28 | |
---|
[6829] | 29 | session_destroy(); |
---|
[6852] | 30 | header( 'Location: '.$row['config_value'].'/login.php' ); |
---|
[6829] | 31 | die(); |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | else |
---|
| 35 | $_SESSION['wallet']['security']['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | } |
---|
| 39 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.