Skip to content
Snippets Groups Projects
Commit 637feba7 authored by Brett Bieber's avatar Brett Bieber
Browse files

Trim newlines off the lines in the file

parent f3984372
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment