summaryrefslogtreecommitdiff
path: root/html/admin.php
blob: 74eb5b7da08b5d163916c976bbf27d4236c824e9 (plain)
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
<?php
if (isset($_REQUEST['rememberkey'])) setcookie('uts_adminkey', $_REQUEST['key'], time()+60*60*24*30*365);
if (isset($_COOKIE['uts_adminkey'])) $adminkey = $_REQUEST['uts_adminkey'];

include ("includes/config.php");
include ("includes/functions.php");
include ("includes/functions_admin.php");
include ("includes/header.php");

// Get key from web browser
if (isset($_REQUEST['key'])) $adminkey = $_REQUEST['key'];
if (!isset($adminkey)) $adminkey = '';
$action = (!empty($_REQUEST['action'])) ? $_REQUEST['action'] : 'main';

echo'<table class = "box" border="0" cellpadding="1" cellspacing="2" width="720">
<tr>
	<td class="heading" align="center" colspan="2">UTStats Administration</td>
</tr>';

IF (empty($import_adminkey)) {
	echo'<tr><td class="smheading" align="left" width="150">Error:</td>
	<td class="grey" align="left">No key set in config.php</td>
	</tr></table>';
	include("includes/footer.php");
	return;
}


IF (!empty($adminkey) and $adminkey != $import_adminkey) {
	echo'<tr><td class="smheading" align="left" width="150">Error:</td>
	<td class="grey" align="left">Keys do not match</td>
	</tr>';
	$adminkey = '';
}

IF (empty($adminkey)) {
	echo'<tr>
		  <td class="smheading" align="left" width="150">Enter Admin key:</td>
		  <td class="grey" align="left"><form NAME="adminkey" ACTION="admin.php">
		  <input TYPE="text" NAME="key" MAXLENGTH="35" SIZE="20" CLASS="searchform">
		  <input TYPE="submit" VALUE="Submit" CLASS="searchformb">
		  <input TYPE="checkbox" NAME="rememberkey"> Remember the key
		  </form></td>
		</tr></table>';
	include("includes/footer.php");
	return;
}


echo'</table>
	<br>';

$action = str_replace(array('.', '/', '<', ':'), array(), $action);
$fn = "pages/admin/$action.php";
if (!file_exists($fn) or !is_file($fn)) die('bla');
require($fn);

include('includes/footer.php');

?>