Results 1 to 6 of 6

Thread: Directory Size / Inbox Size

  1. #1

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193

    Question Directory Size / Inbox Size

    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

  2. #2
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099
    are you try to get the Inbox size of a pop3 account?

  3. #3

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193
    yeah ive sorted the other issue by just looping through the files

  4. #4
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099
    I started a script to download emails from a POP3 server, ill just try and dig it out for you.

  5. #5
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099
    PHP 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";
                }
            }
    ?>
    Hope that helps

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width