lyzi Posted May 4, 2006 Share Posted May 4, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/9060-function-to-output/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.