-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
82 lines (71 loc) · 3.09 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/*
* Copyright (c) Niels Orsleff Justesen <[email protected]> and Nicholas Mossor Rathmann <[email protected]> 2007-2010. All Rights Reserved.
*
*
* This file is part of OBBLM.
*
* OBBLM is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* OBBLM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
$time_start = microtime(true); # Used by MTS().
/*
Includes, constants, error_reporting() level, session_start(), OBBLM run requirements, MySQL connection, language load.
*/
require('header.php');
/********************
* Main routine
********************/
// Make 'main' the default section if no GET section request was sent.
if (!isset($_GET['section'])) {
$_GET['section'] = 'main';
}
// Login?
$_VISSTATE['COOCKIE'] = Coach::cookieLogin(); # If not already logged in then check for login-cookie and try to log in using the stored credentials.
if ($_VISSTATE['POST_IN'] = isset($_POST['login'])) {
if (get_magic_quotes_gpc()) {
$_POST['coach'] = stripslashes($_POST['coach']);
$_POST['passwd'] = stripslashes($_POST['passwd']);
}
if (!Coach::login($_POST['coach'], $_POST['passwd'], isset($_POST['remember']))) {
$_GET['section'] = 'login';
}
}
// Logout?
if ($_VISSTATE['POST_OUT'] = isset($_GET['logout'])) {
$_GET['section'] = 'main'; # Redirect logged out users to the main page.
Coach::logout();
}
if ($_VISSTATE['COOCKIE'] || $_VISSTATE['POST_IN'] || $_VISSTATE['POST_OUT']) {
setupGlobalVars(T_SETUP_GLOBAL_VARS__POST_COACH_LOGINOUT);
}
HTMLOUT::frame_begin(isset($_SESSION['logged_in']) ? $coach->settings['theme'] : $settings['stylesheet']); # Make page frame, banner and menu.
MTS('Header loaded, login auth, html frame generated');
// Check if a menu-link was picked, and execute section code from sections.php accordingly.
switch ($_GET['section'])
{
case 'login': sec_login(); break;
case 'admin': sec_admin(); break;
case 'teamlist': sec_teamlist(); break;
case 'coachlist': sec_coachlist(); break;
case 'rules': sec_rules(); break;
case 'about': sec_about(); break;
case 'matches': sec_matcheshandler(); break; // Tournaments, matches, match reports, recent matches, upcoming matches etc.
case 'objhandler': sec_objhandler(); break; // Object profiles, object standings.
default: sec_main();
}
HTMLOUT::frame_end(); // Spit out all the end-tags.
mysql_close($conn);
MTS('END OF SCRIPT');
?>