<?PHP 
$checkFile1="./../".$SYSD."/messages-new";
$checkFile2="./../".$SYSD."/messages-read";
$checkFile3="./../".$SYSD."/messages-archive";

$handle1=opendir($checkFile1);
if($handle1)
$mailsF1=0;
while($file1=readdir($handle1))
{$mailsF1++;}
$mailsF1=$mailsF1 - 2;

$handle2=opendir($checkFile2);
if($handle2)
$mailsF2=0;
while($file2=readdir($handle2))
{$mailsF2++;}
$mailsF2=$mailsF2 - 2;

$handle3=opendir($checkFile3);
if($handle3)
$mailsF3=0;
while($file3=readdir($handle3))
{$mailsF3++;}
$mailsF3=$mailsF3 - 2;

$saveFile3a="./../".$SYSD."/messagebox3a.inc.txt";
$saveFile3b="./../".$SYSD."/messagebox3b.inc.txt";
$saveFile3c="./../".$SYSD."/messagebox3c.inc.txt";

$handle=fopen($saveFile3a, "w");
fwrite($handle,$mailsF1);
fclose($handle);
$oldumask = umask(0);
chmod($saveFile3a, 0644);
umask($oldumask);

$handle=fopen($saveFile3b, "w");
fwrite($handle,$mailsF2);
fclose($handle);
$oldumask = umask(0);
chmod($saveFile3b, 0644);
umask($oldumask);

$handle=fopen($saveFile3c, "w");
fwrite($handle,$mailsF3);
fclose($handle);
$oldumask = umask(0);
chmod($saveFile3c, 0644);
umask($oldumask);
?>