look at all files, then go elsewhere
| From: | Wolf | Date: | Tue, 11 Sep 2007 14:36:49 +0000 |
| Subject: | look at all files, then go elsewhere | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-261940@lists.php.net to get a copy of this message | ||
All,
I'm trying to figure out the logic piece, and I'm pretty sure I am missing something
simple.
I have a script that I want to check all files in a directory for information, if it doesn't
find it when all done, I want it to go elsewhere, however if it does find it, I want it to break out
of the search and perform a function.
CODE:
if ($userinfo == "")
{
if ($handle = opendir('./bp_csv/')) {
while (false !== ($file = readdir($handle))) {
if($file != '..' && $file != '.') {
if(is_dir($file)) { //Diretory skipped
} else {
$command = 'cat ./bp_csv/' . $file . ' | grep '"';
$user = $_POST[userid];
$command .= $user . '"'';
$userinfo=exec($command);
// here's where it is multi-looping
if ($userinfo =="")
{
echo "$user not found in any BP_CSV files, now running LDAP check<BR>";
ldap_check($user);
}
else
{
// ok, found the person, run the function
userprofile($userinfo);
}
}
}
}
}
}
else
{
//original data has contents, go after user data
userprofile($userinfo);
}
--------------- END CODE
Wolf