3 // echo urldecode ($base_dn)."<br>\n";
6 // echo urldecode ($cn)."<br>\n";
8 $link_identifier = ldap_connect("127.0.0.1");
9 $result_identifier = ldap_read($link_identifier, $base_dn, 'objectclass=*');
10 if(!$result_identifier) {
14 $num_entries = ldap_count_entries($link_identifier, $result_identifier);
15 if ($num_entries == 0) {
19 Header("Content-type: image/jpeg");
20 $info = ldap_get_entries($link_identifier, $result_identifier);
21 ldap_close($link_identifier);
22 for ($i=0; $i<$info["count"]; $i++) {
24 if ($info[$i]["cn"][0] == $cn) {
25 //echo "<b>".$info[$i]["cn"][0]."</b><br>";
27 for ($j=0; $j<$info[$i]["count"]; $j++) {
28 $attribute = $info[$i][$j];
29 if (strtolower ($attribute) == "jpegphoto") {
30 // $file = fopen("/tmp/tmpphoto.jpg", "w");
31 // echo $info[$i]["jpegphoto"][0];
32 $p = $info[$i]["jpegphoto"][0];
33 $photo = base64_decode($p);
35 // fwrite($file, $photo);
38 // $file = fopen("/tmp/tmpphoto.jpg", r);
39 // $contents = fread ($file, filesize("/tmp/tmpphoto.jpg"));