-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
74 lines (62 loc) · 1.64 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
<?php
// Include required configuration file
require_once('includes/config.php');
// Include required template file
require_once('includes/templates.php');
// Include required functions file
require_once('includes/functions.php');
// Include required sessions file
require_once('includes/Session.class.php');
// Start session
session_start('SentinelPlus', 0, '/', 'sentinelplus.net', true);
//SessionManager::sessionStart('SentinelPlus', 0, '/', 'sentinelplus.net', true);
// Check if an API_KEY is defined
if (defined('API_KEY'))
{
// Check for a valid key format
if (valid_key_format('API_KEY'))
{
// Save the key as a session variable
$_SESSION['key'] = encrypt(API_KEY);
// Create the tables if they don't exist
create_tables(API_KEY);
// Redirect to the dashboard
header( 'Location: dashboard.php' );
}
}
// If an API_KEY is not defined
else
{
// If the key is submitted
if (isset($_POST['Login']))
{
// Check for a valid key format
if (valid_key_format($_POST['key']))
{
// Save the key as a session variable
$_SESSION['key'] = encrypt($_POST['key']);
// Create the tables if they don't exist
create_tables($_POST['key']);
// Redirect to the dashboard
header( 'Location: configurations.php' );
}
}
}
?>
<HTML>
<HEAD>
<TITLE>Sentinel+</TITLE>
</HEAD>
<BODY>
<FORM action="<? echo $_SERVER['SCRIPT_NAME']; ?>" method="POST">
<TABLE>
<TR>
<TD>API Key:</TD>
<TD><INPUT name="key" type="password" autocomplete="off" size="32" value="" /></TD>
<TD><INPUT name="Login" type="Submit" value="login" /></TD>
<TD> </TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>