Well, I found out a way to do it...  A litte bit more coding than should
have been required, but still...


$ulist=command("user list name=$username domain=$domain");
$ulist[1] = str_replace('Dir                : ', '', $ulist[1]);

$dir =  $ulist[1];
$strlen = strlen($dir);
$strlen = $strlen - "1";
$dir = substr($dir, 0, $strlen);
$dir = $dir."/data";


 if ($handle = opendir("$dir")) {
  $i = "0";
  while (false !== ($file = readdir($handle))) {
   if ($file != "." && $file != "..") {
    $i++;
   }
  }
  echo "$i";
  closedir($handle);
 }


}




----- Original Message -----
From: "Liam MacKenzie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 15, 2002 3:38 PM
Subject: Re: [PHP] Got another ripper for you all ;-)


Nup, still doesn't work.  I can't get rid of that newline!

Here...  Eat your heart out:


function get_num_emails($username, $domain)
{

$ulist=command("user list name=$username domain=$domain");
$ulist[1] = str_replace('Dir                : ', '', $ulist[1]);

trim($ulist[1]);

echo "|".$ulist[1]."|";

 if ($handle = opendir("$ulist[1]/data")) {
  $i = "0";
  while (false !== ($file = readdir($handle))) {
   if ($file != "." && $file != "..") {
    $i++;
   }
  }
  echo "$i";
  closedir($handle);
 }


}


It's meant to check how many emails that particular user has got, but it
can't get the dir listing because of that damned new line!

Any more ideas?


Cheers,
Liam



----- Original Message -----
From: "Liam MacKenzie" <[EMAIL PROTECTED]>
To: "Tom Rogers" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, August 15, 2002 3:32 PM
Subject: Re: [PHP] Got another ripper for you all ;-)


Oh....

Whoops....

Thanks Tom


----- Original Message -----
From: "Tom Rogers" <[EMAIL PROTECTED]>
To: "Liam MacKenzie" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, August 15, 2002 3:34 PM
Subject: Re: [PHP] Got another ripper for you all ;-)


Hi,

Thursday, August 15, 2002, 3:20:47 PM, you wrote:
>snip

LM> Is there a way to get rid of any new lines in a string?
LM> Because this is making my directory listing go whacko.


LM> Cheers,
LM> Liam


trim($dir)

--
regards,
Tom


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to