-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetUserInfo.php
More file actions
53 lines (33 loc) · 962 Bytes
/
getUserInfo.php
File metadata and controls
53 lines (33 loc) · 962 Bytes
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
<?php
if(!isset($_REQUEST["user"])){
die("Fuck off");
}
$users = $_REQUEST["user"];
if(!is_array($users) && !isset($_REQUEST["test"])){
die("Wrong Data");
}
if(isset($_REQUEST["test"]))
$users = array($users);
require("ldapConfig.php");
require("userInfoFunctions.php");
$ldap = ldap_connect($ldapserver, $ldapport) or die("No connection");
if($ldap){
$ldapbind = ldap_bind($ldap, $ldapuser, $ldappw) or die ("Error trying to bind: ".ldap_error($ldap));
}
$output = array();
require("db.php");
$db = new DB;
for($i = 0; count($users) > $i; $i++){
$result = getRawUserData($users[$i], $ldap);
if($result){
$output[] = array(
"user" => $users[$i],
"displayname" => iconv('UTF-8', 'UTF-8//IGNORE', utf8_encode(getDisplayName($result))),
"costcenter" => $db->getUser2CCbyUser($users[$i]),
"groups" => getGroups($result)
);
}
}
$json = json_encode(array( "users" => $output ));
echo $json;
?>