2 /***************************************************************************
5 * begin : Thursday, Aug 2, 2001
6 * copyright : (C) 2001 The phpBB Group
7 * email : support@phpbb.com
9 * $Id: pagestart.php,v 1.1.2.7 2004/03/24 14:43:31 psotfx Exp $
12 ***************************************************************************/
14 /***************************************************************************
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 ***************************************************************************/
23 if (!defined('IN_PHPBB'))
25 die("Hacking attempt");
28 define('IN_ADMIN', true);
30 include($phpbb_root_path . 'common.'.$phpEx);
33 // Start session management
35 $userdata = session_pagestart($user_ip, PAGE_INDEX);
36 init_userprefs($userdata);
38 // End session management
41 if (!$userdata['session_logged_in'])
43 redirect(append_sid("login.$phpEx?redirect=admin/", true));
45 else if ($userdata['user_level'] != ADMIN)
47 message_die(GENERAL_MESSAGE, $lang['Not_admin']);
50 if ($HTTP_GET_VARS['sid'] != $userdata['session_id'])
52 $url = str_replace(preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name'])), '', $HTTP_SERVER_VARS['REQUEST_URI']);
53 $url = str_replace(preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path'])), '', $url);
54 $url = str_replace('//', '/', $url);
55 $url = preg_replace('/sid=([^&]*)(&?)/i', '', $url);
56 $url = preg_replace('/\?$/', '', $url);
57 $url .= ((strpos($url, '?')) ? '&' : '?') . 'sid=' . $userdata['session_id'];
59 redirect("index.$phpEx?sid=" . $userdata['session_id']);
62 if (empty($no_page_header))
64 // Not including the pageheader can be neccesarry if META tags are
65 // needed in the calling script.
66 include('./page_header_admin.'.$phpEx);