]> git.sur5r.net Git - contagged/blobdiff - img.php
fixed problem with login check
[contagged] / img.php
diff --git a/img.php b/img.php
index 27a49b6c90ea1b0a624c5a304da3b4f79c1bb15c..087ff2da69462cbda39e858f43f4b96d8e8c28bf 100644 (file)
--- a/img.php
+++ b/img.php
@@ -2,15 +2,23 @@
 require_once('inc/init.php');
 ldap_login();
 
+if ($conf['userlogreq'] && !isset($_SESSION['ldapab']['username'])){
+  header("HTTP/1.0 401 Access Denied");
+  echo '<h1>Access Denied</h1>';
+  exit();
+}
+
 $dn = $_REQUEST['dn'];
 
-$sr = ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)',array('jpegPhoto'));
+$sr = ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)',array($FIELDS['photo']));
 if(!ldap_count_entries($LDAP_CON,$sr)){
+  header("HTTP/1.0 404 Not Found");
+  echo '<h1>Not Found</h1>';
   exit;
 }
 $result = ldap_get_binentries($LDAP_CON, $sr);
 $entry  = $result[0];
 
 header("Content-type: image/jpeg");
-print $entry['jpegPhoto'][0];
+print $entry[$FIELDS['photo']][0];
 ?>