diff --git a/index.php b/index.php index 3f14897764644440e7c47e13c7a271cfab58ec17..ac1966c10fd9e121aec98ff5df6f096ce59d40cb 100644 --- a/index.php +++ b/index.php @@ -26,19 +26,20 @@ if (!isset($_FILES, $_FILES['userfile'])) { exit(); } -if (!($contents = file($_FILES['userfile']['tmp_name']))) { +if (!($contents = file($_FILES['userfile']['tmp_name'], FILE_IGNORE_NEW_LINES))) { exit('Could not open file'); } $ldap = UNL_LDAP::getConnection($options); echo '<pre>'; foreach ($contents as $nuid) { + $nuid = rtrim($nuid); if ($results = $ldap->search('dc=unl,dc=edu', '(|(unlUNCWID='.$nuid.')(uid='.$nuid.'))')) { if (!count($results)) { continue; } foreach ($results as $entry) { - echo $entry->unlUNCWID . ',' . $entry->uid.PHP_EOL; + echo $entry->unlUNCWID->__toString() . ',' . $entry->uid->__toString().PHP_EOL; } } }