From 12f6443e99fe484495e5eb04e50e393387b9e295 Mon Sep 17 00:00:00 2001 From: kkalev Date: Tue, 20 Aug 2002 14:34:45 +0000 Subject: [PATCH] Add find pages --- htdocs/find.php3 | 137 +++++++++++++++++++++++++++++++++++++++++++++ lib/ldap/find.php3 | 20 +++++++ lib/sql/find.php3 | 39 +++++++++++++ 3 files changed, 196 insertions(+) create mode 100644 htdocs/find.php3 create mode 100644 lib/ldap/find.php3 create mode 100644 lib/sql/find.php3 diff --git a/htdocs/find.php3 b/htdocs/find.php3 new file mode 100644 index 0000000..aa9014f --- /dev/null +++ b/htdocs/find.php3 @@ -0,0 +1,137 @@ + + + +Find User Page + + + +
+ + + + +
+ +
+
+ + + + + +
+ + +
+ Find User Page  +
+
+ + +
+ + + + + + +EOM; + foreach ($found_users as $user){ + $num++; + $msg .= << + + + +EOM; + } + $msg .= "
#user
$num$user
\n"; + } + +} +?> +
+ + + + + + + + + + +EOM; +} +?> + + + + + + + + +
+Search Criteria + + + +
+RADIUS Attribute + +
+Criteria Contains + + +
+Max Results + + +
+
+ +
+ +$msg +EOM; +} +?> +
+
+ + diff --git a/lib/ldap/find.php3 b/lib/ldap/find.php3 new file mode 100644 index 0000000..72a353c --- /dev/null +++ b/lib/ldap/find.php3 @@ -0,0 +1,20 @@ +Could not connect to the LDAP server
\n"; +?> diff --git a/lib/sql/find.php3 b/lib/sql/find.php3 new file mode 100644 index 0000000..d2ddd70 --- /dev/null +++ b/lib/sql/find.php3 @@ -0,0 +1,39 @@ +Could not include SQL library
\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 + "Database query failed: " . da_sql_error($link,$config) . "
\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 + "Database query failed: " . da_sql_error($link,$config) . "
\n"; + } +} +else + echo "Could not connect to database
\n"; +?> -- 2.39.5