Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_time_limit(0);
- $starttime = explode(' ', microtime());
- $starttime = $starttime[1] + $starttime[0];
- $SERVER = "{eu.news.astraweb.com:119/nntp}";
- $GROUP = "php.general";
- $USER = " ";
- $PASS = " ";
- $nntp = imap_open($SERVER.$GROUP, $USER, $PASS)
- or die("can't connect: " . imap_last_error());
- $header = imap_header($nntp, $msg);
- $last = imap_num_msg($nntp);
- $n = 20;
- print <<<EOH
- <table>
- <tr>
- <th align="left">Subject</th>
- <th align="left">Sender</th>
- <th align="left">Date</th>
- </tr>
- EOH;
- for ($i = $last-$n+1; $i <= $last; $i++) {
- $header = imap_header($nntp, $i);
- if (! $header->Size) { continue; }
- $subj = $header->subject;
- $from = $header->from;
- $email = $from[0]->mailbox."@".$from[0]->host;
- $name = $from[0]->personal ? $from[0]->personal : $email;
- $date = date('m/d/Y h:i A', $header->udate);
- print <<<EOM
- <tr>
- <td>$subj</td>
- <td>$name</td>
- <td>$date</td>
- </tr>
- EOM;
- }
- echo "</table>\n";
- $mtime = explode(' ', microtime());
- $totaltime = $mtime[0] + $mtime[1] - $starttime;
- printf('Page loaded in %.3f seconds.', $totaltime);
- imap_close($nntp);
- ?>
Add Comment
Please, Sign In to add comment