// Author: Jon Belanger
// Date: Nov. 2004
// comments: linked to in index.php
// start the session
session_start();
include("functions.php");
include("gui.php");
// check if the session username or seclevel are not set
// this would occur if the user was trying to get here without logging in
if (! $_SESSION['username'] | ! $_SESSION['seclevel']) {
redirect("logout.php");
exit(1);
}
// only admins and experts can display users
if ($_SESSION['seclevel'] == "user") {
redirect("logout.php");
exit(1);
}
?>
echo $_SESSION['version']; ?> - Edit Users
display_header("Edit Users");
?>
Main - Edit Users
|
if ($_GET['error']) {
echo "** ";
echo $_GET['error'];
} else {
echo " ";
}
?>
|
// check our cookies
if ($_COOKIE["filterGroup"]) {
$fGroup=$_COOKIE['filterGroup'];
} else {
$fGroup='*';
}
if ($_COOKIE['filterType']) {
$fType=$_COOKIE['filterType'];
} else {
$fType='*';
}
if (! $_COOKIE['sort']) {
$_COOKIE['sort']="sn";
}
if (! $_COOKIE['snfilter']) {
$_COOKIE['snfilter']="A";
}
// make connection to ldap to get list of users
$ds=connect_to_ldap($_SESSION['server'], $_SESSION['port'], $_SESSION['ssl'], 3);
//if connection successful
if ($ds) {
// bind to LDAP anonymously
$r=ldap_bind($ds);
// filter ldap users based on cookie values
$sr=ldap_search($ds, $_SESSION['userbase'], "(&(sn=".$_COOKIE['snfilter']."*)(uid=*)(objectClass=posixAccount)(employeeType=".$fType."))");
ldap_sort($ds,$sr,$_COOKIE['sort']);
$tempinfo = ldap_get_entries($ds, $sr);
$j=0;
for ($i=0;$i<$tempinfo["count"];$i++) {
if (member_of_group($ds,$_SESSION['suffix'],$fGroup,$tempinfo[$i]['uid'][0])) {
$info[$j] = $tempinfo[$i];
$j++;
}
}
?>
User Type Legend:
|
  | Admin |   | Expert |   | User |   | Inactive |   | Expired |
// close the LDAP connection
ldap_close($ds);
}
else { echo "can't connect"; }
?>