-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathserverconfig.php
205 lines (186 loc) · 7.86 KB
/
serverconfig.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?
include("config.php");
include("lib/functions.php");
mysql_connect($host, $user, $pass) or die(mysql_error());
mysql_select_db($table) or die(mysql_error());
if ($_POST['update'] == "yes") {
$serverid = $_POST['serverid'];
unset($_POST['update']);
unset($_POST['submit']);
foreach ($_POST as $key => $value) {
//$$key = $value;
if ($value == "NULL") {
mysql_query("UPDATE servers SET `$key` = NULL where serverid = '$serverid'") or die(mysql_error());
} else {
mysql_query("UPDATE servers SET `$key` = '$value' where serverid = '$serverid'") or die(mysql_error());
}
}
header("Location: servers.php");
die();
}
$settings = getsettings();
$servercfg = getserver($_GET['serverid']);
$servercfg = $servercfg['0'];
//if (!empty($_POST)) header("Location: servers.php");
?>
<body><div id="container">
<form method="post" action="serverconfig.php" class="niceform">
<fieldset>
<legend>Changing individual server configuration for</legend>
<b><? echo $servercfg['servername'];?></b><br/>
<? echo "IP: " . $servercfg['ip'] . ":" .$servercfg['port'] . "<br/>Version " . $servercfg['version'] . "/" . $servercfg['network'] . "<br/>Type: " . $servercfg['type'];
if ($servercfg['os'] == 'l') { echo '<br/> Running on Linux'; }
elseif ($servercfg['os'] == 'w') { echo '<br/> Running on Windows'; }
echo '</legend>';
echo '</fieldset>';
if ($servercfg['type'] == 'left4dead' || $servercfg['type'] == 'left4dead2') {
?>
<fieldset>
<legend>l4d(2) options (LEAVE BLANK IF YOU DONT HAVE FORKS)</legend>
<dl>
<dt><label for="netconport">Netcon Port</label></dt>
<dd><input type="text" name="netconport" id="netconport" size="40" maxlength="255" value="<? echo $servercfg['netconport'];?>" /></dd>
</dl>
<dl>
<dt><label for="netconpasswd">Netcon Password</label></dt>
<dd><input type="text" name="netconpasswd" id="netconpasswd" size="40" maxlength="255" value="<? echo $servercfg['netconpasswd'];?>" /></dd>
</dl>
</fieldset>
</legend>
<? } ?>
<fieldset>
<legend>Options</legend>
<dl>
<dt><label for="rconpass">Rcon Password</label></dt>
<dd><input type="text" name="rconpass" id="rconpass" size="40" maxlength="255" value="<? echo $servercfg['rconpass'];?>" /></dd>
</dl>
<dl>
<dt><label for="showmotd">Show server in MOTD?</label></dt>
<dd>
<select size="1" name="showmotd" id="showmotd">
<? if ($servercfg['showmotd'] == 'yes') {
echo '<option value="yes" selected="selected">Yes</option>';
echo '<option value="no">No</option>';}
else {
echo '<option value="no" selected="selected">No</option>';
echo '<option value="yes">Yes</option>';
}?>
</select>
</dd>
</dl>
<?
$tags = $servercfg['servertags'];
if (preg_match("/replays/i","$tags")) {
?>
<dl>
<dt><label for="replaymatch">Store MatchID's?</label></dt>
<dd>
<select size="1" name="replaymatch" id="usereplay">
<? if ($servercfg['replaymatch'] == 'yes') {
echo '<option value="yes" selected="selected">Yes</option>';
echo '<option value="no">No</option>';}
else {
echo '<option value="no" selected="selected">No</option>';
echo '<option value="yes">Yes</option>';
}?>
</select>
</dd>
</dl>
<? } ?>
<dl>
<dt><label for="multic">Useable in multi console?</label></dt>
<dd>
<select size="1" name="multic" id="multic">
<? if ($servercfg['multic'] == 'yes') {
echo '<option value="yes" selected="selected">Yes</option>';
echo '<option value="no">No</option>';}
else {
echo '<option value="no" selected="selected">No</option>';
echo '<option value="yes">Yes</option>';
}?>
</select>
</dd>
</dl>
<dl>
<dt><label for="autoupdate">Auto update this server?</label></dt>
<dd>
<select size="1" name="autoupdate" id="autoupdate">
<? if ($servercfg['autoupdate'] == 'yes') {
echo '<option value="yes" selected="selected">Yes</option>';
echo '<option value="no">No</option>';}
else {
echo '<option value="no" selected="selected">No</option>';
echo '<option value="yes">Yes</option>';
}?>
</select>
</dd>
</dl>
<dl>
<dt><label for="updatemessage">Update message to send before restart</label></dt>
<dd><input type="text" name="updatemessage" id="updatemessage" size="40" maxlength="255" value="<? echo $servercfg['updatemessage'];?>" /></dd>
</dl>
</fieldset>
<?
$type = $servercfg['type'];
if (!preg_match("/left4dead/i","$type")) { ?>
<fieldset>
<legend>Daily restarts</legend>
<dl>
<dt><label for="dlyrestart">Daily Restart?</label></dt>
<dd>
<select size="1" name="dlyrestart" id="dlyrestart">
<? if ($servercfg['dlyrestart'] == 'yes') {
echo '<option value="yes" selected="selected">Yes</option>';
echo '<option value="no">No</option>';}
else {
echo '<option value="no" selected="selected">No</option>';
echo '<option value="yes">Yes</option>';
}?>
</select>
</dd>
</dl>
<dl>
<dt><label for="dlytime">Daily time to Restart</label></dt>
<? $hhmm = date('H:i', strtotime($servercfg['dlytime'])); ?>
<dd><input type="text" name="dlytime" id="dlytime" size="5" maxlength="5" value="<? echo $hhmm;?>" /></dd>
</dl>
<dl>
<dt><label for="dlycmd">Restart Command</label></dt>
<dd><input type="text" name="dlycmd" id="dlycmd" size="40" maxlength="255" value="<? echo $servercfg['dlycmd'];?>" /></dd>
</dl>
<dl>
<dt><label for="dlyusers">Max. Player Count</label></dt>
<dd><?
echo '<select size="4" name="dlyusers" id="dlyusers">';
$players=1;
if ($servercfg['dlyusers'] == NULL) {
echo '<option value=NULL id=dlyusers selected=selected>Dont Check</option>';
} else {
echo '<option value=NULL id=dlyusers>Dont Check</option>';
}
while($players<=$servercfg['maxplayers']) {
if ($servercfg['dlyusers'] == $players) {
echo "<option value=\"" . $players . "\" id=\"dlyusers\" selected>" . $players . " " . ( $players == "1" ? "Player" : "Players") . "</option>";
} else {
echo "<option value=\"" . $players . "\" id=\"dlyusers\">" . $players . " " . ( $players == "1" ? "Player" : "Players") . "</option>";
}
$players++;
}
echo '<br/>';
?></dd>
</dl>
</fieldset>
<? } ?>
<fieldset class="action">
<input type="hidden" name="update" value="yes">
<input type="hidden" name="serverid" value="<? echo $_GET['serverid'];?>">
<div style="clear: both;"></div>
<div style="width:200px;"><input type="submit" name="submit" id="submit" value="Submit" />
<input type="button" value="Cancel" onclick="$( '#serverall' ).dialog('close');"></div>
</fieldset>
</form>
</div></body>
</html>
<?
mysql_close();
?>