-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax_getmembers.php
67 lines (60 loc) · 1.75 KB
/
ajax_getmembers.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
require_once("shared.php");
$rc = -1;
$msg = "";
$rows = Array();
try
{
if (isset($_POST['uuid']) && isset($_POST['itype']))
{
$uuid = $_POST['uuid'];
$itype = (int)$_POST['itype'];
$userid = SharedGetUserIdFromUuid($uuid, $dblink);
$clause = "";
// Non-admins can only see their own entry...
if ($itype != 99)
$clause = "and u1.uuid=" . SharedNullOrQuoted($uuid, 64, $dblink);
$dbselect = "select " .
"u1.uuid," .
"concat(u1.firstname,' ',u1.lastname) name," .
"u1.email," .
"u1.itype," .
"u1.mobile," .
"u1.regno," .
"u1.company," .
"u1.datecreated," .
"u1.datemodified " .
"from " .
"users u1 " .
"where " .
"u1.dateexpired is null " .
"and " .
"u1.id!= 1 " .
$clause . " " .
"order by " .
"name";
if ($dbresult = SharedQuery($dbselect, $dblink))
{
if ($numrows = SharedNumRows($dbresult))
{
while ($dbrow = SharedFetchArray($dbresult))
$rows[] = $dbrow;
$rc = 0;
}
else
$msg = "Unable to fetch list of members...";
}
else
$msg = "Unable to fetch list of members...";
}
else
$msg = "Missing parameters...";
}
catch (Exception $e)
{
$msg = "Unable to fetch members...";
}
$response = array("rc" => $rc, "msg" => $msg, "rows" => $rows);
$json = json_encode($response);
echo $json;
?>