/[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

Annotation of /html/find.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations)
Tue Mar 27 13:44:55 2001 UTC (23 years, 1 month ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +5 -4 lines
...

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

  ViewVC Help
Powered by ViewVC 1.1.26