[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/ -> logout.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @author Mambo Foundation Inc see README.php
   5  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   6  * See COPYRIGHT.php for copyright notices and details.
   7  * @license GNU/GPL Version 2, see LICENSE.php
   8  *
   9  * Redistributions of files must retain the above copyright notice.
  10  *
  11  * Mambo is free software; you can redistribute it and/or
  12  * modify it under the terms of the GNU General Public License
  13  * as published by the Free Software Foundation; version 2 of the License.
  14  */
  15  
  16  /** ensure this file is being included by a parent file */
  17  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  18  
  19  $currentDate = date("Y-m-d\TH:i:s");
  20  
  21  if (isset($_SESSION['session_user_id']) && $_SESSION['session_user_id']!="") {
  22      // @RawSQLUse, trivial_implementation, UPDATE
  23      $database->setQuery( "UPDATE #__users SET lastvisitDate='$currentDate' WHERE id='" . $_SESSION['session_user_id'] . "'");
  24  
  25      if (!$database->query()) {
  26          echo $database->stderr();
  27      }
  28  }
  29  
  30  if (isset($_SESSION['session_id']) && $_SESSION['session_id']!="") {
  31      // @RawSQLUse, trivial_implementation, DELETE
  32      $database->setQuery( "DELETE FROM #__session WHERE session_id='" . $_SESSION['session_id'] . "'");
  33  
  34      if (!$database->query()) {
  35          echo $database->stderr();
  36      }
  37  }
  38  
  39  $name = "";
  40  $fullname = "";
  41  $id = "";
  42  $session_id = "";
  43  
  44  session_unregister( "session_id" );
  45  session_unregister( "session_user_id" );
  46  session_unregister( "session_username" );
  47  session_unregister( "session_usertype" );
  48  session_unregister( "session_logintime" );
  49  
  50  if (session_is_registered( "session_id" )) {
  51      session_destroy();
  52  }
  53  if (session_is_registered( "session_user_id" )) {
  54      session_destroy();
  55  }
  56  if (session_is_registered( "session_username" )) {
  57      session_destroy();
  58  }
  59  if (session_is_registered( "session_usertype" )) {
  60      session_destroy();
  61  }
  62  if (session_is_registered( "session_logintime" )) {
  63      session_destroy();
  64  }
  65  $configuration =& mamboCore::getMamboCore();
  66  $configuration->redirect( "../index.php" );
  67  ?>