home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / xamp / xampp-win32.exe / xampp / group.php < prev    next >
Encoding:
PHP Script  |  2004-10-01  |  3.1 KB  |  78 lines

  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Alexander Merz <alexmerz@php.net>                           |
  17. // |                                                                      |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: group.php,v 1.1.4.1 2004/07/01 16:56:35 heino Exp $
  21. ?>
  22. <html>
  23. <head>
  24.     <title>NNTP news.php.net</title>
  25. </head>
  26. <body>
  27. <?php
  28. require_once "Net/NNTP.php";
  29.  
  30. $nntp = new Net_NNTP;
  31.  
  32. $ret = $nntp->connect("news.php.net");
  33. if( PEAR::isError($ret)) {
  34.  echo '<font color="red">No connection to newsserver!</font><br>' ;
  35.  echo $ret->getMessage();
  36. } else {
  37.     if(isset($_GET['group'])) {
  38.         $msgdata = $nntp->selectGroup($_GET['group']);
  39.         if(PEAR::isError($msgdata)) {
  40.             echo '<font color="red">'.$msgdata->getMessage().'</font><br>' ;        
  41.         } else {
  42.             $msgcount = $msgdata['last']-$msgdata['first'];
  43.             echo '<h1>'.$_GET['group'].'</h1>';
  44.             echo "<b>Message count:</b> ".$msgcount;
  45.             echo "<br><b>Posting allowed:</b> ";
  46.             switch( $_GET['writable']) {
  47.                 case 'y' :
  48.                     echo 'yes';
  49.                     break;
  50.                 case 'n' :
  51.                     echo 'no';
  52.                     break;
  53.                 case 'm' :
  54.                     echo 'moderated';
  55.                     break;         
  56.                 default:
  57.                     echo 'n/a';                       
  58.             }
  59.             echo "<hr>";
  60.             echo "<h2>last 10 messages</h2>";
  61.                 
  62.             $msgs = array_reverse($nntp->getOverview( $msgcount-9, $msgcount));
  63.             foreach($msgs as $msgid => $msgheader) {
  64.                 echo '<a href="read.php?msgid='.urlencode($msgid).
  65.                     '&group='.urlencode($_GET['group']).
  66.                     '"><b>'.$msgheader["Subject"].'</b></a><br>';
  67.                 echo 'from: '.$msgheader["From"]."<br>";
  68.                 echo $msgheader["Date"].'<br><br>';
  69.             }        
  70.         }
  71.     } else {
  72.         echo '<font color="red">No newsgroup choosed!</font><br>' ;    
  73.     }
  74.     $nntp->quit();
  75. }    
  76. ?>
  77. </body>
  78. </html>