Guest User

Untitled

a guest
Oct 4th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3.  
  4. $starttime = explode(' ', microtime());
  5. $starttime = $starttime[1] + $starttime[0];
  6.  
  7. $SERVER = "{eu.news.astraweb.com:119/nntp}";
  8. $GROUP = "php.general";
  9. $USER = " ";
  10. $PASS = " ";
  11.  
  12. $nntp = imap_open($SERVER.$GROUP, $USER, $PASS)
  13. or die("can't connect: " . imap_last_error());
  14.  
  15. $header = imap_header($nntp, $msg);
  16.  
  17. $last = imap_num_msg($nntp);
  18. $n = 20;
  19.  
  20. print <<<EOH
  21. <table>
  22. <tr>
  23. <th align="left">Subject</th>
  24. <th align="left">Sender</th>
  25. <th align="left">Date</th>
  26. </tr>
  27. EOH;
  28.  
  29. for ($i = $last-$n+1; $i <= $last; $i++) {
  30. $header = imap_header($nntp, $i);
  31.  
  32. if (! $header->Size) { continue; }
  33.  
  34. $subj = $header->subject;
  35. $from = $header->from;
  36. $email = $from[0]->mailbox."@".$from[0]->host;
  37. $name = $from[0]->personal ? $from[0]->personal : $email;
  38. $date = date('m/d/Y h:i A', $header->udate);
  39.  
  40. print <<<EOM
  41. <tr>
  42. <td>$subj</td>
  43. <td>$name</td>
  44. <td>$date</td>
  45.  
  46. </tr>
  47. EOM;
  48. }
  49.  
  50. echo "</table>\n";
  51.  
  52. $mtime = explode(' ', microtime());
  53. $totaltime = $mtime[0] + $mtime[1] - $starttime;
  54. printf('Page loaded in %.3f seconds.', $totaltime);
  55.  
  56.  
  57. imap_close($nntp);
  58. ?>
Add Comment
Please, Sign In to add comment