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

Diff of /html/find.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by dpavlin, Wed May 3 08:28:04 2000 UTC revision 1.5 by dpavlin, Tue Mar 27 13:44:55 2001 UTC
# Line 4  use Net::LDAP; Line 4  use Net::LDAP;
4  use Net::LDAP::LDIF;  use Net::LDAP::LDIF;
5  use CGI qw/:standard/;  use CGI qw/:standard/;
6    
7  $ldap = Net::LDAP->new('ldap.pliva.hr',port=>389) || die "$@";  $host = "ldap.pliva.hr";
8    
9    $ldap = Net::LDAP->new($host,port=>389) || die "$@";
10    
11  $ldap->bind;    # anonymous  $ldap->bind;    # anonymous
12    
13  %labels = ('givenname'=>'ime',  %labels = ('givenname'=>'imenu',
14          'sn'=>'prezime',          'sn'=>'prezimenu',
15          'cn'=>'ime i prezime');          'cn'=>'imenu i prezimenu');
16    
17    
18  print header,  print header,
19          start_html('LDAP pretraživanje'),          start_html('LDAP pretraživanje'),
20          start_form,          start_form,
21          "Pretražujte prema",popup_menu(-name=>'what',          "Pretražujte prema ",popup_menu(-name=>'what',
22                  -values=>['givenname','sn','cn'],                  -values=>['givenname','sn','cn'],
23                  -default=>'cn',                  -default=>'cn',
24                  -labels=>\%labels),                  -labels=>\%labels),
25          textfield(-name=>'search',-default=>'*'),p,          textfield(-name=>'search',-default=>'*'),
26          submit,          submit(-value=>"Počni"),p
27          end_form;          end_form;
28    
29  if(param()) {  if(param()) {
30          $mesg = $ldap->search (          $mesg = $ldap->search (
31                  base    => 'o=pliva.hr',                  base    => 'o=pliva.hr',
         #       filter  => 'sn=Pavlinusic'  
32                  filter  => param('what').'='.param('search')                  filter  => param('what').'='.param('search')
33                  );                  );
34    
35          print begin_ul;          print begin_ul;
36          my $max = $mesg->count;          my $max = $mesg->count;
37            print "Broj osoba koje odgovaraju upitu: ",$mesg->count,p;
38          for($i = 0 ; $i < $max ; $i++) {          for($i = 0 ; $i < $max ; $i++) {
39                  my $entry = $mesg->entry($i);                  my $entry = $mesg->entry($i);
40                  print li($entry->get('cn')," e-mail: ",$entry->get('mail'));                  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;          print end_ul;
45                    

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.26