-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStartSession.php
48 lines (43 loc) · 1.35 KB
/
StartSession.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
<?php
include 'UsefulFunctions.php';
getNavHeader();
getServHeader();
define("DEFAULT_ADDRESS","172.17.0.106");
define("DEFAULT_PORT","27015");
define("DEFAULT_PASSWORD","pass");
if(!defined($_SESSION['address'])) {
$_SESSION['address'] = DEFAULT_ADDRESS;
}
if(!defined($_SESSION['port'])) {
$_SESSION['port'] = DEFAULT_PORT;
}
if(!defined($_SESSION['password'])) {
$_SESSION['password'] = DEFAULT_PASSWORD;
}
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION['address'] = $_POST["address"];
$_SESSION['port'] = $_POST["port"];
$_SESSION['password'] = $_POST["password"];
$_SESSION['valid'] = testLogin($_SESSION['address'],
$_SESSION['port'], $_SESSION['password']);
}
?>
<html>
<body>
<form name="Login" method="POST">
<table>
<tr><td>Address:</td> <td><input type="text" name="address" value="<?php echo $_SESSION['address'];?>"></text></td></tr>
<tr><td>Port:</td> <td><input type="text" name="port" value="<?php echo $_SESSION['port'];?>"></text></td></tr>
<tr><td>Password:</td> <td><input type="text" name="password" value="<?php echo $_SESSION['password'];?>"></text></td></tr>
<tr><td><input type="submit" name="submit" value="Login"></td></tr>
</table>
</form>
<?php
if($_SESSION['valid']) {
echo "Login Successful <a href=\"index.php\">Continue</a>";
} else {
echo "<b><font color=\"red\">Invalid Login</font></a>";
}
?>
<html>
<body>