Jump to content

function to output


lyzi

Recommended Posts

So basically this code makes a query to display the output of a mail statistic.
like this:
[img src=\"http://img.photobucket.com/albums/v679/paiperdull/fuckingoutput.jpg\" border=\"0\" alt=\"IPB Image\" /]

the code is:
[code]
<?php

function mailstat($output)
{
    if ( $output )
        {
            $output = array_reverse($output);
            echo "<table border=\"1\" cellspacing=\"2\" cellpadding=\"2\">";
            foreach ($output as $line)
            {
                echo "<tr>";
                echo "<td>$line</td>";
                echo "</tr>";
            }
            echo "</table>";
            echo "<table border=\"1\" cellspacing=\"2\" cellpadding=\"2\">";
            foreach ( $output as $line )
            {
            preg_match("/([A-Z][a-z][a-z]\s[A-Z][a-z][a-z]\-\d{2}\-\d{4}\s\d+:\d+:\d+)\s+\d+\s\d+\s.*/",$line,$folder);
            echo var_dump($folder);
            preg_match("/Current Usage:\s(\d+)\sKB of\s(\d+)\s(.*)/",$line,$usage);
            $use = $usage[1]; $limit = $usage[2]; $percent = $usage[3];
            preg_match("/Password:\s(.*)\s\((.*)\)/",$line,$info);
            $pwd = $info[1]; $status = $info[2];
            preg_match("/Mailserver:\s(.*)/",$line,$server);
            $mailserver = $server;
            }
            echo "<tr>";
            echo "<td>$use</td>"; // Usage
            echo "<td>$limit</td>"; // Usage Limit
            echo "<td>$percent</td>"; // Usage Percent
            echo "<td>$pwd</td>"; // Password
            echo "<td>$status</td>"; // Status - active/inactive
            echo "<td>$mailserver</td>";  // Mailserver
            echo "</tr>";
            echo "</table>";
        }
        else
        {
            echo "No records found.</br>";
        }
}
?>
[/code]


What can I do, so that the output looks more like this:

Mail Statistics

mail: user@domain.com
host: mail.lyzi.net
=====================
|| Folder || Time || Usag ||
=====================
inbox Apr-29 1.4M
draft Jan-01 25K

Total usage: 1.45M
Limit: 25M
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.