From 637feba75e4af6713fad8c2caeb5b2dcfc79fb5f Mon Sep 17 00:00:00 2001 From: Brett Bieber <brett.bieber@gmail.com> Date: Fri, 25 May 2012 16:33:27 -0500 Subject: [PATCH] Trim newlines off the lines in the file --- index.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 3f14897..ac1966c 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; } } } -- GitLab