/[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.5 - (show annotations)
Tue Mar 27 13:44:55 2001 UTC (20 years, 9 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +5 -4 lines
...

1 #!/usr/local/bin/perl -w
2
3 use Net::LDAP;
4 use Net::LDAP::LDIF;
5 use CGI qw/:standard/;
6
7 $host = "ldap.pliva.hr";
8
9 $ldap = Net::LDAP->new($host,port=>389) || die "$@";
10
11 $ldap->bind; # anonymous
12
13 %labels = ('givenname'=>'imenu',
14 'sn'=>'prezimenu',
15 'cn'=>'imenu i prezimenu');
16
17
18 print header,
19 start_html('LDAP pretra¾ivanje'),
20 start_form,
21 "Pretra¾ujte prema ",popup_menu(-name=>'what',
22 -values=>['givenname','sn','cn'],
23 -default=>'cn',
24 -labels=>\%labels),
25 textfield(-name=>'search',-default=>'*'),
26 submit(-value=>"Poèni"),p
27 end_form;
28
29 if(param()) {
30 $mesg = $ldap->search (
31 base => 'o=pliva.hr',
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 my ($cn)=$entry->get('cn');
42 print li($cn,a({href=>"mailto:$mail"},"$mail"));
43 }
44 print end_ul;
45
46 }

  ViewVC Help
Powered by ViewVC 1.1.26