home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / blocks / block-last_referers.php < prev    next >
Encoding:
PHP Script  |  2002-09-16  |  1.9 KB  |  44 lines

  1. <?php
  2.  
  3. /************************************************************************/
  4. /* PHP-NUKE: Web Portal System                                          */
  5. /* ===========================                                          */
  6. /*                                                                      */
  7. /* Copyright (c) 2002 by Francisco Burzi                                */
  8. /* http://phpnuke.org                                                   */
  9. /*                                                                      */
  10. /* Last referers block for phpNuke portal                               */
  11. /* Copyright (c) 2001 by Jack Kozbial (jack@internetintl.com            */
  12. /* http://www.InternetIntl.com                                          */
  13. /*                                                                      */
  14. /* This program is free software. You can redistribute it and/or modify */
  15. /* it under the terms of the GNU General Public License as published by */
  16. /* the Free Software Foundation; either version 2 of the License.       */
  17. /************************************************************************/
  18.  
  19. if (eregi("block-Last_Referers.php",$PHP_SELF)) {
  20.     Header("Location: index.php");
  21.     die();
  22. }
  23.  
  24. global $prefix, $dbi, $admin;
  25.  
  26. $ref = 10; // how many referers in block
  27. $a = 1;
  28. $result = sql_query("select rid, url from ".$prefix."_referer order by rid DESC limit 0,$ref", $dbi);
  29. while(list($rid, $url) = sql_fetch_row($result, $dbi)) {
  30.     $url2 = ereg_replace("_", " ", $url);
  31.     if(strlen($url2) > 18) {
  32.     $url2 = substr($url,0,20);
  33.         $url2 .= "..";
  34.     }
  35.     $content .= "$a: <a href=\"$url\" target=\"new\">$url2</a><br>";
  36.     $a++;
  37. }
  38. if (is_admin($admin)) {
  39.     $total = sql_num_rows(sql_query("select * from ".$prefix."_referer", $dbi), $dbi);
  40.     $content .= "<br><center>$total "._HTTPREFERERS."<br>[ <a href=\"admin.php?op=delreferer\">"._DELETE."</a> ]</center>";
  41.     
  42. }
  43.  
  44. ?>