<?php
// $Id: auth.php,v 1.12 2003/12/01 05:24:37 eddieajau Exp $
/**
* Administration authentication code
* @package Mambo Open Source
* @Copyright (C) 2000 - 2003 Miro International Pty Ltd
* @ All rights reserved
* @ Mambo Open Source is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @version $Revision: 1.12 $
**/

// ensure this file is being included by a parent file
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

if (file_exists("../../configuration.php")) {
	require_once( "../../configuration.php" );
} else if (file_exists("../../../configuration.php")) {
	require_once( "../../../configuration.php" );
}
if (!defined( '_MOS_MAMBO_INCLUDED' )) {
	if (file_exists("../../classes/mambo.php")) {
		require_once( "../../classes/mambo.php" );
	} else if (file_exists("../../../classes/mambo.php")) {
		require_once( "../../../classes/mambo.php" );
	}
}

session_name( 'mosadmin' );
session_start();
// restore some session variables
if (!isset( $my )) {
	$my = new mosUser( $database );
}

$my->id = $_SESSION['session_user_id'];
$my->username = $_SESSION['session_username'];
$my->usertype = $_SESSION['session_usertype'];
$my->gid = $_SESSION['session_gid'];

$session_id = mosGetParam( $_SESSION, 'session_id', '' );
$logintime = mosGetParam( $_SESSION, 'session_logintime', '' );

if ($session_id != md5( $my->id.$my->username.$my->usertype.$logintime )) {
	mosRedirect( "../index.php" );
	die;
}
?>