This repository has been archived by the owner on Apr 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jsonroles.php
43 lines (30 loc) · 1.17 KB
/
jsonroles.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
<?php
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
//// I DON'T BELIEVE THIS FILE IS ACTUALLY BEING USED....
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
require_once('config.php');
mustBeLoggedIn(); //anons don't need access to this, so let's not give it
$link = startmysql();
$sqltitlein = "";
if (isset($_GET['q'])) {
$titlein = $_GET['q'];
$titlein = mysql_real_escape_string($titlein);
$sqltitlein = " WHERE `title` LIKE '" . $titlein . "%'";
}
$sql = "SELECT * FROM `" . $sql_pref . "roles`" . $sqltitlein /*. " WHERE `roletype`=1" *//*. " ORDER BY `" . $sql_pref . "roles`.`title` ASC" */. " LIMIT 0, 500";
$result = mysql_query($sql) or die("<span class=\"errortext\">Query failed:<br>\n" . mysql_error() . "</span>");
$rolesarr = array();
for($i=0; $i < mysql_num_rows($result); $i++) {
$row = mysql_fetch_row($result);
$rolesarr[$i] = array(
'label' => $row[1],
'value' => $row[0]
);
}
header('Content-type:application/json');
echo json_encode($rolesarr);
mysql_free_result($result);
mysql_close($link);
?>