Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <?php
  2.  
  3.   $username = "uid";
  4.   $password = "secret";
  5.  
  6.   $ds = ldap_connect("ldaps://bv1.ruf.uni-freiburg.de", "636");
  7.   if (ldap_bind($ds, "uid={$username},ou=people,dc=uni-freiburg,dc=de", $password))
  8.   {
  9.      
  10.     // Suchen des Nachnamen-Eintrags
  11.     $sr = ldap_search($ds, "ou=people,dc=uni-freiburg,dc=de", "uid={$username}");
  12.    
  13.     $info = ldap_get_entries($ds, $sr);
  14.  
  15.     echo "<h1>Willkommen {$info[0]['givenname'][0]} {$info[0]['sn'][0]}</h1>
  16.    <h2>Fakultaet: No.{$info[0]['ruffakultaet'][0]} - {$info[0]['rufaccounttype'][0]}</h2>";
  17.  
  18.     ldap_close($ds);
  19.    
  20.   } else {
  21.       echo("permission denied");
  22.   }
  23.  
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement