-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSSHTest.php
170 lines (136 loc) · 4.68 KB
/
SSHTest.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
/*
GamePanelX
Description: Update configuration
Author: Ryan D. Gehrig
License: GNU General Public License (GPL)
*/
include('include/config.php');
include_once('include/auth.php');
include_once('include/SqlCon.php');
include_once('include/infobox.php');
include_once('include/statusInfo.php');
//Make check to see if the logged in user is an admin.
$query = "SELECT is_admin FROM users WHERE username='$GPXuserName'";
sqlCon($query);
if($row['is_admin'] != 'Y')
{
include('Unauthorized.php');
exit(0);
}
if(!isset($_POST['submit']))
{
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/<?php echo $config['theme']; ?>/main.css">
<script type="text/javascript">
function checkReq()
{
if(document.sshTest.ip.value == "" || document.sshTest.ip.value == "none")
{
alert('You must select a Remote Server!');
return false;
}
return true;
}
</script>
</head>
<body leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px" onLoad="init()">
<div id="loading" style="position:absolute; top:60px; left:5px; overflow: hidden;"><img src="images/loading.gif" border="0"></div>
<script src="include/loading.js"></script>
<table border="0" cellpadding="0" cellspacing="0" align="center" width="100%" height="40" background="css/<?php echo $config['theme']; ?>/img/largeGrad.png">
<tr>
<td align="center" valign="middle"><span class="top_page_titles">Test SSH Connection</span></td>
</tr>
</table>
<br /><br />
<form method="post" name="sshTest" action="<?php echo $PHP_SELF; ?>" onSubmit="return checkReq()">
<table border="0" class="tablez" cellpadding="2" cellspacing="0" align="center" width="400">
<tr background="css/<?php echo $config['theme']; ?>/img/smallGrad.png" height="20">
<td colspan="12" align="left"> <span class="top_titles">Select a server</span></td>
</tr>
<tr class="rowz_title">
<td colspan="2"> </td>
</tr>
<tr class="rowz_title">
<td colspan="2" align="center"><img src="images/main/cmd-line.png" border="0" /></td>
</tr>
<tr class="rowz_title">
<td colspan="2"> </td>
</tr>
<tr class="rowz_title">
<td align="right"><span class="rowz_alt">Physical Server:</span> </td>
<td align="left">
<select name="ip">
<?php
// List available physical servers
require('include/functions.php');
$type = 'physical';
list_available_ips($type);
?>
</td>
</tr>
<tr class="rowz_title">
<td colspan="2"> </td>
</tr>
<tr class="rowz_title">
<td align="center" colspan="3"><input type="submit" name="submit" value="Confirm" style="width:170px"></td>
</tr>
</table>
</form>
</body>
</html>
<?php
}
elseif(isset($_POST['submit']))
{
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/<?php echo $config['theme']; ?>/main.css">
</head>
<body leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px" onLoad="init()">
<div id="loading" style="position:absolute; top:60px; left:5px; overflow: hidden;"><img src="images/loading.gif" border="0"></div>
<script src="include/loading.js"></script>
<table border="0" cellpadding="0" cellspacing="0" align="center" width="100%" height="40" background="css/<?php echo $config['theme']; ?>/img/largeGrad.png">
<tr>
<td align="center" valign="middle"><span class="top_page_titles">Test SSH Connection</span></td>
</tr>
</table>
<br /><br />
<?php
// Make sure IP wasn't empty
if(empty($_POST['ip']))
{
die('<center><b>Error:</b> IP Address was left empty!</center>');
}
// Encode IP Address
$encoded_ip = base64_encode($_POST['ip']);
?>
<form method="post" action="include/runcmd.php">
<input type="hidden" name="previous_page" value="SSHTest.php">
<table border="0" class="tablez" cellpadding="2" cellspacing="0" align="center" width="400">
<tr background="css/<?php echo $config['theme']; ?>/img/smallGrad.png" height="20">
<td colspan="12" align="left"> <span class="top_titles">Confirm Server</span></td>
</tr>
<tr class="rowz_title">
<td colspan="2"> </td>
</tr>
<tr class="rowz_title">
<td align="right"><span class="rowz_alt">Testing on IP: </span></td>
<td align="left"><b><?php echo $_POST['ip']; ?></b></td>
</tr>
<tr class="rowz_title">
<td colspan="2"> </td>
</tr>
<tr class="rowz_title">
<td align="center" colspan="3"><input type="submit" name="test_ssh_connection" value="Test Connection" style="width:170px"></td>
</tr>
</table>
<input type="hidden" name="ip" value="<?php echo $encoded_ip; ?>">
<input type="hidden" name="previous_page" value="SSHTest.php">
</form>
<?php
}
?>