Jump to content

Archived

This topic is now archived and is closed to further replies.

lyzi

function to output

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

Share this post


Link to post
Share on other sites

×

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.