source: trunk/header.session.inc.php @ 2522

Revision 2522, 2.1 KB checked in by amuller, 14 years ago (diff)

Ticket #559 - Corrigindo código que foi depreciado por motivos desconhecidos

Line 
1<?php
2
3        /***************************************************************************
4        * Expresso Livre                                                           *
5        * http://www.expressolivre.org                                             *
6        * --------------------------------------------                             *
7        *  This program is free software; you can redistribute it and/or modify it *
8        *  under the terms of the GNU General Public License as published by the   *
9        *  Free Software Foundation; either version 2 of the License, or (at your  *
10        *  option) any later version.                                              *
11        \**************************************************************************/
12        if ( isset( $_COOKIE[ 'sessionid' ] ) )
13                session_id( $_COOKIE[ 'sessionid' ] );
14
15        session_start( );
16        $sess = $_SESSION[ 'phpgw_session' ];
17        $user_ip =  (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']);
18        $connection_id = "{$sess['session_id']}{$user_ip}".substr($_SERVER[ 'HTTP_USER_AGENT' ],0,199);
19 
20        if ( empty($_SESSION['phpgw_session']['session_id']) ||
21                ($_SESSION['connection_db_info']['user_auth'] && implode('',$_SESSION['connection_db_info']['user_auth']) !== $connection_id)
22        )
23        {
24                if($_SESSION['connection_db_info']['user_auth'] && !strstr($_SERVER['SCRIPT_URL'],"/controller.php")) {
25                        error_log( '[ INVALID SESSION ] >>>>' . implode('',$_SESSION['connection_db_info']['user_auth']) . '<<<< - >>>>' . $connection_id . '<<<<', 0 );
26                        @require_once dirname( __FILE__ ) . '/logout.php';
27                }
28
29                setcookie(session_name(),"",0); // Removing session cookie.
30                unset($_SESSION);                               // Removing session values.
31                // From ExpressoAjax response "nosession"
32                if(strstr($_SERVER['SCRIPT_URL'],"/controller.php")){
33                        echo serialize(array("nosession" => true));
34                        exit;
35                }
36        }
37        else{
38                // From ExpressoAjax update session_dla (datetime last access).
39                if(strstr($_SERVER['SCRIPT_URL'],"/controller.php"))
40                        $_SESSION['phpgw_session']['session_dla'] = time();
41        }
42?>
Note: See TracBrowser for help on using the repository browser.