--On Friday, August 04, 2006 4:22 PM -0400 Tim Crouch <[EMAIL PROTECTED]> wrote:

That is exactly what I am looking for.  Cany you point me to some
guidelines on how to do this?  I am NOT a programmer, but can modify stuff
that's already working.

Thx for any help!

Stanford.Who mainly uses the Stanford::Directory perl module, which is simply an extension of the Net::LDAP perl module. The main idea is that it creates a web form in perl, and then passes the parameters placed in the form into a query of the LDAP servers.

This example gets the user name from the environment, but could be made to take the input from a form:

tribes:~/cgi-bin/examples> more ldap-perl.cgi
#!/usr/local/bin/perl
$ID = q$Id: ldap.pl,v 1.1 2004/06/12 02:45:09 morpheus Exp $;
#
# ldap.pl -- A ldap query demo script.

##############################################################################
# Site configuration
##############################################################################

use strict;
use vars qw($DIR);

use CGI qw(:standard);
use Stanford::Directory;

$DIR = new Stanford::Directory;
$DIR->set (ldap_server    => "ldap.stanford.edu",
          mechanism => "GSSAPI",
          basedn         => "cn=people,dc=stanford, dc=edu");

##############################################################################
# Main routine
##############################################################################

print header, start_html;

my %userinfo;
my $person=$ENV{WEBAUTH_USER};
my @entries = $DIR->ldap_query ("(susearchid=$person)");
foreach my $entry (@entries) {
   foreach my $attr (keys (%{$entry})) {
       push @{$userinfo{$attr}}, @{$entry->{$attr}};
   }
}

foreach my $attr (sort keys %userinfo) {
   print strong($attr), ": ", join (", ", @{$userinfo{$attr}}), br;
}

print end_html;



--
Quanah Gibson-Mount
Principal Software Developer
ITS/Shared Application Services
Stanford University
GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html

---
You are currently subscribed to [email protected] as: [EMAIL PROTECTED]
To unsubscribe send email to [EMAIL PROTECTED] with the word UNSUBSCRIBE as the 
SUBJECT of the message.

Reply via email to