How can i get the size of a directory (without subdirs) in php
also how can i do this with an email inbox ?
thanks people
Printable View
How can i get the size of a directory (without subdirs) in php
also how can i do this with an email inbox ?
thanks people
are you try to get the Inbox size of a pop3 account?
yeah ive sorted the other issue by just looping through the files
I started a script to download emails from a POP3 server, ill just try and dig it out for you.
Hope that helpsPHP Code:<?
header('Content-Type: Text/plain');
$server = "mail.domain.co.uk";//server address
$username = "[email protected]";//username
$password = "password";//password
$fp = fsockopen($server,110,$errno,$errdesc);
//open connection to POP3 server
if($fp){
$welcome = fgets($fp,150);
//wait for welcome message from server
if(substr($welcome,0,3)=="+OK"){ // check that the response is ok
fputs($fp,"USER $username\r\n"); //send your username
fgets($fp,1024); //wait for the response can check this
//repsonse for extra validity
fputs($fp,"PASS $password\r\n");//send password
$ack = fgets($fp,1024); //get response on state
if(substr($ack,0,3)=="+OK"){ //check to see if user && pass are correct
print "Login OK\n";
fputs($fp,"STAT\r\n"); //ask for the stats of the mailbox
$output = fgets($fp,1024);
$output = split(" ",$output);//split the response into useful inforation
//resonse looks like +OK 1 200
// first number mail count
//second number mailbox size
print "Messages:\t\t{$output[1]}\n";//display message count
print "MailBox Size:\t\t{$output[2]}\n";//display mail box size
}else{
print "Failed: $ack\n";
}
}else{
print "Failed: $welcome\n";
}
}
?>
For POP3 the STAT command returns two numbers. The first is the number of messages in the mailbox and the second is the total size of all the messages.
You can also use LIST to return the size of individual messages.