/[ldap]/html/find.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /html/find.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Fri May 26 10:12:02 2000 UTC (23 years, 11 months ago) by dpavlin
Branch: MAIN
Changes since 1.3: +1 -0 lines
send errors to browser

1 #!/usr/local/bin/perl -w
2
3 use Net::LDAP;
4 use Net::LDAP::LDIF;
5 use CGI qw/:standard/;
6 use CGI::Carp qw(fatalsToBrowser);
7
8 $ldap = Net::LDAP->new('ldap.pliva.hr',port=>389) || die "$@";
9
10 $ldap->bind; # anonymous
11
12 %labels = ('givenname'=>'imenu',
13 'sn'=>'prezimenu',
14 'cn'=>'imenu i prezimenu');
15
16
17 print header,
18 start_html('LDAP pretra¾ivanje'),
19 start_form,
20 "Pretra¾ujte prema ",popup_menu(-name=>'what',
21 -values=>['givenname','sn','cn'],
22 -default=>'cn',
23 -labels=>\%labels),
24 textfield(-name=>'search',-default=>'*'),
25 submit(-value=>"Poèni"),p
26 end_form;
27
28 if(param()) {
29 $mesg = $ldap->search (
30 base => 'o=pliva.hr',
31 # filter => 'sn=Pavlinusic'
32 filter => param('what').'='.param('search')
33 );
34
35 print begin_ul;
36 my $max = $mesg->count;
37 print "Broj osoba koje odgovaraju upitu: ",$mesg->count,p;
38 for($i = 0 ; $i < $max ; $i++) {
39 my $entry = $mesg->entry($i);
40 my ($mail) = $entry->get('mail'); # array, take first
41 print li($entry->get('cn')," <tt><a href=\"mailto: $mail\">$mail</a></tt>");
42 }
43 print end_ul;
44
45 }

  ViewVC Help
Powered by ViewVC 1.1.26