-
Notifications
You must be signed in to change notification settings - Fork 0
/
ss_current_members.php
46 lines (35 loc) · 1.26 KB
/
ss_current_members.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
<?php
require_once "/home/cacti/www_secure/db.php";
/* do NOT run this script through a web browser */
if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
die("<br><strong>This script is only meant to run at the command line.</strong>");
}
$no_http_headers = true;
/* display ALL errors */
error_reporting(0);
if (!isset($called_by_script_server)) {
include_once(dirname(__FILE__) . "/../include/global.php");
array_shift($_SERVER['argv']);
print call_user_func_array("ss_current_members", $_SERVER['argv']);
}
function ss_current_members($status) {
$idb = db_link();
switch ($status) {
case 5:
$roles = "('member.current', 'member.young', 'member.temporarybanned')";
break;
case 6:
$roles = "('member.ex', 'member.banned')";
break;
default:
return ;
break;
}
$query = "SELECT count(user_id) AS members FROM user u INNER JOIN role_user ru ON (ru.user_id = u.id) INNER JOIN roles r ON (r.id = ru.role_id) WHERE r.name IN $roles";
$result = $idb->query($query);
$output = "";
while ($row = $result->fetch_object())
$output .= 'members:'.$row->members;
return $output;
}
?>