-
Notifications
You must be signed in to change notification settings - Fork 0
/
servers.php
67 lines (63 loc) · 1.6 KB
/
servers.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
<?php
include('includes/functions.php');
$host = $_POST['host'];
$port = intval($_POST['port']);
$username = $_POST['username'];
$password = $_POST['password'];
$add = $_POST['add'];
$delete = $_POST['delete'];
if (isset($host, $port, $username, $password, $add)) {
if (addServer($mysql, $host, $port, $username, $password)) {
$success = true;
} else {
$success = false;
}
} elseif (isset($host, $port)) {
if (delServer($mysql, $host, $port)) {
$delSuccess = true;
} else {
$delSuccess = false;
}
}
?>
<html>
<body>
<center>
<h2>Add A Server</h2>
<p>You can add servers manually here.<br>
Enter all of the details below.<br>
<form action="servers.php" method="post">
Host: <input type="form" name="host"><br>
Port: <input type="form" name="port" value="22"><br>
Username: <input type="form" name="username" value="root"><br>
Password: <input type="password" name="password"><br>
<input type="hidden" name="add" value="true">
<input type="submit">
</form>
<br>
<?php
if ($success) {
echo "Server added succesfully.";
} elseif (isset($success)) {
echo "Error, could not add server, please check details.";
}
?>
</p>
<h2>Remove A Server</h2>
<p>You can manually remove a server here.<br>
<form action="servers.php" method="post">
Host: <input type="form" name="host"><br>
Port: <input type="form" name="port"><br>
<input type="submit">
</form>
<br>
<?php
if ($delSuccess) {
echo "Server removed successfully.";
} elseif (isset($delSuccess)) {
echo "Server could not be removed.";
}
?>
</center>
</body>
</html>