[snip]
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);
}
[/snip]
Put all of the locations you want to search in an array and loop through
the array.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php