-
Notifications
You must be signed in to change notification settings - Fork 6
/
showplugins.php
102 lines (82 loc) · 2.72 KB
/
showplugins.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
<?php
include("config.php");
include("lib/functions.php");
$start = head();
mysql_connect($host, $user, $pass) or die(mysql_error());
mysql_select_db($table) or die(mysql_error());
//error_reporting(E_ALL);
//ini_set("display_errors", 1);
function showmods($serverid) {
$result = mysql_query("SELECT * from mods where modid in (select modid from srv_mods where serverid = '$serverid')") or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
$filename = $row['filename'];
$title = $row['title'];
$author = $row['author'];
$version = $row['version'];
$url = $row['url'];
$status = $row['status'];
$reloads = $row['reloads'];
$timestamp = $row['timestamp'];
print "------- Sourcemod Plugin -----\n";
print "$filename\n";
print "$title\n";
print "$author\n";
print "$version\n";
print "$url\n";
print "$status\n";
print "$reloads\n";
print "$timestamp\n<br/>";
}
}
function showmetas($serverid) {
$result = mysql_query("SELECT * from metamods where metaid in (select metaid from srv_mods where serverid = '$serverid')") or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
$name = $row['name'];
$version = $row['version'];
$description = $row['description'];
$url = $row['url'];
$details = $row['details'];
$file = $row['file'];
print "------- Metamod Plugin -------\n";
print "$name\n";
print "$version\n";
print "$description\n";
print "$url\n";
print "$details\n";
print "$file\n<br/>";
}
}
$serverid = $_GET['serverid'];
$mod = $_GET['mod'];
?>
<form>
<select name="serverid">
<?php
$result = mysql_query( "SELECT * from servers ORDER BY servername" ) or die( mysql_error() ); // retrieve all servers
while( $row = mysql_fetch_array( $result ) ) // for each result
echo "<option value=\"" . $row['serverid'] . "\"" . ( $row['serverid'] == $serverid ? "selected" : "") . ">" . $row['servername'] . "</option>";
?>
</select>
<select name="mod">
<option value="source" <?php if( $mod == "source" ) echo 'selected'; ?>>Sourcemod</option>
<option value="meta" <?php if( $mod == "meta" ) echo 'selected'; ?>>Metamod</option>
<option value="both" <?php if( $mod == "both" ) echo 'selected'; ?>>Both</option
</select>
<input type="submit" value="Retrieve Plugins"/>
</form>
<pre>
<?php
if ($mod == "source")
showmods($serverid);
elseif ($mod == "meta")
showmetas($serverid);
elseif ($mod == "both") {
showmods($serverid);
print "<b>========================================================================</b>\n";
print "<b>========================================================================</b>\n";
showmetas($serverid);
}
print "</pre>";
mysql_close();
bottom($start);
?>