--- /dev/null
+<?php
+require('../conf/config.php3');
+$selected[$search_IN] = 'selected';
+$selected[$radius_attr] = 'selected';
+$max = ($max_results) ? $max_results : 40;
+?>
+<html>
+<head>
+<title>Find User Page</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<table border=0 width=550 cellpadding=0 cellspacing=0>
+<tr valign=top>
+<td align=center><img src="images/title2.gif"></td>
+</tr>
+</table>
+<table border=0 width=400 cellpadding=0 cellspacing=2>
+</table>
+<br>
+<table border=0 width=540 cellpadding=1 cellspacing=1>
+<tr valign=top>
+<td width=340></td>
+<td bgcolor="black" width=200>
+ <table border=0 width=100% cellpadding=2 cellspacing=0>
+ <tr bgcolor="#907030" align=right valign=top><th>
+ <font color="white">Find User Page</font>
+ </th></tr>
+ </table>
+</td></tr>
+<tr bgcolor="black" valign=top><td colspan=2>
+ <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
+ <tr><td>
+
+<?php
+if ($find_user == 1){
+ if (is_file("../lib/$config[general_lib_type]/find.php3"))
+ include("../lib/$config[general_lib_type]/find.php3");
+ if (isset($found_users)){
+ $num = 0;
+ $msg .= <<<EOM
+<p>
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+ <tr bgcolor="#d0ddb0">
+ <th>#</th><th>user</th>
+ </tr>
+EOM;
+ foreach ($found_users as $user){
+ $num++;
+ $msg .= <<<EOM
+ <tr align=center>
+ <td>$num</td>
+ <td><a href="user_admin.php3?login=$user" title="Edit user $user">$user</a></td>
+ </tr>
+EOM;
+ }
+ $msg .= "</table>\n";
+ }
+
+}
+?>
+ <form method=post>
+ <input type=hidden name=find_user value="0">
+ <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
+<tr>
+<td align=right bgcolor="#d0ddb0">
+Search Criteria
+</td>
+<td>
+
+<?php
+echo <<<EOM
+<select name="search_IN" editable onChange="this.form.submit();">
+<option $selected[name] value="name">User Full Name
+<option $selected[ou] value="ou">User Department
+<option $selected[radius] value="radius">User Radius Attribute
+EOM;
+?>
+
+</select>
+</td>
+</tr>
+<?php
+if ($search_IN == 'radius'){
+ require('../lib/attrshow.php3');
+ echo <<<EOM
+<tr>
+<td align=right bgcolor="#d0ddb0">
+RADIUS Attribute
+</td>
+<td>
+<select name="radius_attr" editable>
+EOM;
+ foreach($show_attrs as $key => $desc)
+ echo "<option $selected[$key] value=\"$key\">$desc\n";
+ echo <<<EOM
+</select>
+</td>
+</tr>
+EOM;
+}
+?>
+<tr>
+<td align=right bgcolor="#d0ddb0">
+Criteria Contains
+</td>
+<td>
+<input type=text name="search" value="<?php echo $search ?>" size=25>
+</td>
+</tr>
+<tr>
+<td align=right bgcolor="#d0ddb0">
+Max Results
+</td>
+<td>
+<input type=text name="max_results" value="<?php echo $max ?>" size=25>
+</td>
+</tr>
+ </table>
+<br>
+<input type=submit class=button value="Find User" OnClick="this.form.find_user.value=1">
+</form>
+<?php
+if ($find_user == 1){
+ echo <<<EOM
+<br>
+$msg
+EOM;
+}
+?>
+ </td></tr>
+</table>
+</tr>
+</table>
+</body>
+</html>
--- /dev/null
+<?php
+$ds=@ldap_connect("$config[ldap_server]"); // must be a valid ldap server!
+if ($ds) {
+ $r=@ldap_bind($ds,"$config[ldap_binddn]",$config[ldap_bindpw]);
+ if ($search_IN == 'name' || $search_IN == 'ou')
+ $attr = ($search_IN == 'name') ? 'cn' : 'ou';
+ else if ($search_IN == 'radius'){
+ require('../lib/ldap/attrmap.php3');
+ $attr = $attrmap[$radius_attr];
+ }
+ $sr=@ldap_search($ds,"$config[ldap_base]", "$attr=*$search*",array('uid'));
+ if (($info = @ldap_get_entries($ds, $sr))){
+ for ($i = 0; $i < $info["count"]; $i++)
+ $found_users[] = $info[$i]['uid'][0];
+ }
+ @ldap_close($ds);
+}
+else
+ echo "<b>Could not connect to the LDAP server</b><br>\n";
+?>
--- /dev/null
+<?php
+if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+ include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+else{
+ echo "<b>Could not include SQL library</b><br>\n";
+ exit();
+}
+
+$link = @da_sql_pconnect($config);
+if ($link){
+ if (($search_IN == 'name' || $search_IN == 'ou') && $config[sql_use_user_info_table] == 'true'){
+ $attr = ($search_IN == 'name') ? 'Name' : 'Department';
+ $res = @da_sql_query($link,$config,
+ "SELECT UserName FROM $config[sql_user_info_table] WHERE
+ $attr LIKE '%$search%';");
+ if ($res){
+ while(($row = @da_sql_fetch_array($res,$config)))
+ $found_users[] = $row[UserName];
+ }
+ else
+ "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
+ }
+ else if ($search_IN == 'radius' && $radius_attr != ''){
+ require("../lib/sql/attrmap.php3");
+ $table = ($attr_type[$radius_attr] == 'checkItem') ? $config[sql_check_table] : $config[sql_reply_table];
+ $attr = $attrmap[$radius_attr];
+ $res = @da_sql_query($link,$config,
+ "SELECT UserName FROM $table WHERE Attribute = '$attr' AND Value LIKE '%$search%';");
+ if ($res){
+ while(($row = @da_sql_fetch_array($res,$config)))
+ $found_users[] = $row[UserName];
+ }
+ else
+ "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
+ }
+}
+else
+ echo "<b>Could not connect to database</b><br>\n";
+?>