Page 1 of 1

searching directories

Posted: Wed May 18, 2005 4:16 pm
by phierce
I neen to write a script to "audit" email accounts on my website. All the accounts should have a number in them that coresponds to the users employee ID. For example John Smith has employee IF 105, his email account is john105@xxx.com.

Now I have all the directories and I am retrieving a list of inactive people from my database and I am trying to check if a directory with thier name+id exsists, but I am having troubles, here is how I am trying it

Code: Select all

$checkDir = &quote;/home/xyz/mail/xyzmail.com/&quote;.$inactiveї&quote;firstName&quote;].$inactiveї&quote;id&quote;];
if(is_dir($checkDir))
{
     printf(&quote;<tr><td>%s %s</td><td>%s</td><td>%s</td><td>%s%s</td></tr>&quote;,
     $inactive&#1111;&quote;firstName&quote;], $inactive&#1111;&quote;lastName&quote;], $inactive&#1111;&quote;plsid&quote;], $inactive&#1111;&quote;emailAddress&quote;],
     $inactive&#1111;&quote;firstName&quote;], $inactive&#1111;&quote;id&quote;]);
}
Nothing is happening even if I do

Code: Select all

echo is_dir('$checkDir');
but I can do

Code: Select all

echo is_dir('/home/xyz/mail/xyzmail.com/john105');
A better solution if anyone can help me is to just have a function that says "Is there a directory that contains '105' in it?" and return that directory.

Thanks if you can offer any help!

Posted: Wed May 18, 2005 7:26 pm
by Skara

Code: Select all

echo is_dir('$checkDir');
variables will not parse inside single quotes. ;)
should be:

Code: Select all

echo is_dir($checkDir);
or, if you really want to use quotes...

Code: Select all

echo is_dir("{$checkDir}");
I'd simply write...

Code: Select all

if (is_dir("/home/xyz/mail/xyzmail.com/{$inactive['firstName']}{$inactive['id']}")) {
  // ^_^
}