fix get user data; fix qrcode library

master
Marc Wäckerlin 8 years ago
parent 3a20a4b277
commit 4e8b759612
  1. 14
      etc/authentication.php
  2. 2
      etc/settings.php
  3. 6
      html/index.php

@ -23,11 +23,19 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
ldap_start_tls($ldapconn) ldap_start_tls($ldapconn)
or error_die($ldapconn, "cannot start LDAP TLS"); or error_die($ldapconn, "cannot start LDAP TLS");
if ($ldapbind = @ldap_bind($ldapconn, $checkuser.'='.$tstusername.','.$ldapbase, $password)) { if ($ldapbind = @ldap_bind($ldapconn, $checkuser.'='.$tstusername.','.$ldapbase, $password)) {
ldap_bind($ldap, 'username', 'password'); $search = ldap_search($ldapconn, $ldapbase, $checkuser.'='.$tstusername, array('mail\
$search = ldap_search($ldapconn, 'base_dn', 'search_filter', array('mail', 'cn')); ', 'cn'));
$data = ldap_get_entries($ldap, $search); $data = ldap_get_entries($ldapconn, $search);
ldap_close($ldapconn); ldap_close($ldapconn);
$username = $tstusername; $username = $tstusername;
$email = array('count' => 1, 0 => $username.'@'.$_SERVER[HTTP_HOST]);
$fullname = $username;
if ($data['count']==1) {
if (isset($data[0]['mail']))
$email = $data[0]['mail'];
if (isset($data[0]['cn'][0]))
$fullname = $data[0]['cn'][0];
}
} else { } else {
error_log("user login failed: ".$checkuser.'='.$tstusername.','.$ldapbase); error_log("user login failed: ".$checkuser.'='.$tstusername.','.$ldapbase);
error_log(ldap_error($ldapconn)); error_log(ldap_error($ldapconn));

@ -1,5 +1,5 @@
<?php <?php
require_once('qrlib.php'); require_once('/usr/share/phpqrcode/qrlib.php'); // configure path to phpqrcode
$imagepath = "/path/to/your/files"; $imagepath = "/path/to/your/files";
$thumbpath = "/var/tmp/sharing-gallery/thumbnails/"; $thumbpath = "/var/tmp/sharing-gallery/thumbnails/";
$max_validity_days = "30"; $max_validity_days = "30";

@ -158,12 +158,6 @@
} }
if (!isset($_REQUEST['secret'])) { if (!isset($_REQUEST['secret'])) {
if ($username=="") error_die('not authorized', '403 Forbidden'); if ($username=="") error_die('not authorized', '403 Forbidden');
?>
<h1>Your Login Data</h2>
<pre>
<?php print_r($data) ?>
</pre>
<?php
if (isset($_REQUEST['path'])) checkPath($_REQUEST['path']); if (isset($_REQUEST['path'])) checkPath($_REQUEST['path']);
if (isset($_REQUEST['folder']) && !preg_match('/\//', $_REQUEST['folder'])) { if (isset($_REQUEST['folder']) && !preg_match('/\//', $_REQUEST['folder'])) {
$file = $thumbpath.'/folders/'.$subpath.'/'.$_REQUEST['folder'].'.png'; $file = $thumbpath.'/folders/'.$subpath.'/'.$_REQUEST['folder'].'.png';

Loading…
Cancel
Save