PageRenderTime 37ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/administrator/includes/auth.php

https://bitbucket.org/dgough/annamaria-daneswood-25102012
PHP | 53 lines | 30 code | 8 blank | 15 comment | 12 complexity | 9185af646f958d92a7523b9f5056fa5f MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * @version $Id: auth.php 6022 2006-12-18 22:30:07Z friesengeist $
  4. * @package Joomla
  5. * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
  6. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
  7. * Joomla! is free software. This version may have been modified pursuant
  8. * to the GNU General Public License, and as distributed it includes or
  9. * is derivative of works licensed under the GNU General Public License or
  10. * other free or open source software licenses.
  11. * See COPYRIGHT.php for copyright notices and details.
  12. */
  13. // no direct access
  14. defined( '_VALID_MOS' ) or die( 'Restricted access' );
  15. $basePath = dirname( __FILE__ );
  16. require( $basePath . '/../../globals.php' );
  17. // $basepath reintialization required as globals.php will kill initial when RGs Emulation `Off`
  18. $basePath = dirname( __FILE__ );
  19. require( $basePath . '/../../configuration.php' );
  20. // SSL check - $http_host returns <live site url>:<port number if it is 443>
  21. $http_host = explode(':', $_SERVER['HTTP_HOST'] );
  22. if( (!empty( $_SERVER['HTTPS'] ) && strtolower( $_SERVER['HTTPS'] ) != 'off' || isset( $http_host[1] ) && $http_host[1] == 443) && substr( $mosConfig_live_site, 0, 8 ) != 'https://' ) {
  23. $mosConfig_live_site = 'https://'.substr( $mosConfig_live_site, 7 );
  24. }
  25. if (!defined( '_MOS_MAMBO_INCLUDED' )) {
  26. $path = $basePath . '/../../includes/joomla.php';
  27. require( $path );
  28. }
  29. session_name( md5( $mosConfig_live_site ) );
  30. session_start();
  31. // restore some session variables
  32. if (!isset( $my )) {
  33. $my = new mosUser( $database );
  34. }
  35. $my->id = intval( mosGetParam( $_SESSION, 'session_user_id', '' ) );
  36. $my->username = strval( mosGetParam( $_SESSION, 'session_username', '' ) );
  37. $my->usertype = strval( mosGetParam( $_SESSION, 'session_usertype', '' ) );
  38. $my->gid = intval( mosGetParam( $_SESSION, 'session_gid', '' ) );
  39. $session_id = strval( mosGetParam( $_SESSION, 'session_id', '' ) );
  40. $logintime = strval( mosGetParam( $_SESSION, 'session_logintime', '' ) );
  41. if ( $session_id != md5( $my->id.$my->username.$my->usertype.$logintime ) ) {
  42. mosRedirect( 'index.php' );
  43. die;
  44. }
  45. ?>