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

Revision 2364, 1.9 KB checked in by amuller, 14 years ago (diff)

Ticket #1008 - Adicionando licença aos arquivos php

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    $connection_id = "{$sess['session_id']}{$sess['session_ip']}".substr($_SERVER[ 'HTTP_USER_AGENT' ],0,199);
18 
19        if ( empty($_SESSION['phpgw_session']['session_id']) ||
20                ($_SESSION['connection_db_info']['user_auth'] && implode('',$_SESSION['connection_db_info']['user_auth']) !== $connection_id)
21        )
22        {
23                if($_SESSION['connection_db_info']['user_auth'] && !strstr($_SERVER['SCRIPT_URL'],"/controller.php"))
24                        error_log( '[ INVALID SESSION ] >>>>' . implode('',$_SESSION['connection_db_info']['user_auth']) . '<<<< - >>>>' . $connection_id . '<<<<', 0 );
25
26                setcookie("PHPSESSID","",0);
27                setcookie ("sessionid","",0);   
28                unset($_SESSION);
29                // From ExpressoAjax response "nosession"
30                if(strstr($_SERVER['SCRIPT_URL'],"/controller.php")){
31                        echo serialize(array("nosession" => true));
32                        exit;
33                }
34        }
35        else{
36                // From ExpressoAjax update session_dla (datetime last access).
37                if(strstr($_SERVER['SCRIPT_URL'],"/controller.php"))
38                        $_SESSION['phpgw_session']['session_dla'] = time();
39        }
40?>
Note: See TracBrowser for help on using the repository browser.