PALMisLIFE 討論區

搜索
鹹魚爸魅力四射舞蹈教室
查看: 2426|回復: 1
打印 上一主題 下一主題

[Discuz! Hack]站上即時狀態專屬簽名檔(2.0/3.0 皆適用)

[複製鏈接]

139

主題

1

好友

783

積分

詹姆士‧阿喃

該用戶從未簽到

文章
555
跳轉到指定樓層
1#
發表於 2003-10-7 06:35 |只看該作者 |倒序瀏覽
範例演示:



++++++++++++++++++++++++++++++++++
安裝方法:
++++++++++++++++++++++++++++++++++

把以下代碼存成 statspng.php ,儲存後放到論壇的根目錄。

  1. <?php

  2. /*
  3.         [DISCUZ!] statspng.php - board images statistics
  4.         This is NOT a freeware, use is subject to license terms

  5.         Version: 2.0.0
  6.         Author: Loveyuki ([email]webmaster@loveyuki.com[/email])
  7.         Copyright: Soar Computer Studio (www.loveyuki.com)
  8.         Last Modified: 2003/10/6 17:00
  9. */

  10. define('IN_DISCUZ', TRUE);
  11. Header("Content-type: image/PNG");

  12. require 'config.php';
  13. require 'include/db_'.$database.'.php';

  14. $tables = array('members', 'posts', 'sessions', 'stats');
  15. foreach($tables as $tablename) {
  16.         ${'table_'.$tablename} = $tablepre.$tablename;
  17. }
  18. unset($tablename);

  19. $db = new dbstuff;
  20. $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
  21. $db->select_db($dbname);
  22. unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);

  23. $query = $db->query("SELECT count,type,var FROM $table_stats WHERE type='".total."' and var='".hits."'");
  24. $stats = $db->fetch_array($query);
  25. $stats = $stats['count'];
  26. $query = $db->query("SELECT count(*) FROM $table_members");
  27. $members = $db->result($query,0);
  28. $query = $db->query("SELECT count(*) FROM $table_posts");
  29. $posts = $db->result($query,0);
  30. $query = $db->query("SELECT count(*) FROM $table_sessions");
  31. $online = $db->result($query,0);

  32. if(getenv('HTTP_CLIENT_IP')) {
  33.         $onlineip = getenv('HTTP_CLIENT_IP');
  34. } elseif(getenv('HTTP_X_FORWARDED_FOR')) {
  35.         $onlineip = getenv('HTTP_X_FORWARDED_FOR');
  36. } elseif(getenv('REMOTE_ADDR')) {
  37.         $onlineip = getenv('REMOTE_ADDR');
  38. } else {
  39.         $onlineip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
  40. }

  41. $currenttime = date("Y-m-d A");

  42. $im = @imagecreatefromgif("images/statspng.gif");
  43. $white = ImageColorAllocate($im, 255,255,255);
  44. $black = ImageColorAllocate($im, 0,0,0);

  45. imagestring($im, 3, 138, 2, $stats, $black);
  46. imagestring($im, 3, 137, 1, $stats, $white);

  47. imagestring($im, 3, 138, 17, $posts, $black);
  48. imagestring($im, 3, 137, 16, $posts, $white);

  49. imagestring($im, 3, 138, 32, $members, $black);
  50. imagestring($im, 3, 137, 31, $members, $white);

  51. imagestring($im, 3, 265, 2, $onlineip, $black);
  52. imagestring($im, 3, 264, 1, $onlineip, $white);

  53. imagestring($im, 3, 265, 17, $online, $black);
  54. imagestring($im, 3, 264, 16, $online, $white);

  55. imagestring($im, 3, 265, 32, $currenttime, $black);
  56. imagestring($im, 3, 264, 31, $currenttime, $white);

  57. ImagePNG($im);
  58. ImageDestroy($im);
  59. ?>
複製代碼


再把附件的圖另存新檔後,修改您的站名,存到圖檔根目錄中。

[ Last edited by jamesanna on 2003-10-7 at 06:37 ]
分享淘帖0 分享分享0 收藏收藏0 頂0 踩0
etwing 該用戶已被刪除
2#
發表於 2003-11-28 03:05 |只看該作者

Re: [Discuz! Hack]站上即時狀態專屬簽名檔(2.0/3.0 皆適用)

thanks!!
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 免費註冊

與站長聯繫| PALMisLIFE 掌上生活      下載:更快、更棒、更好玩

GMT+8, 2024-11-26 05:38 , Processed in 0.045363 second(s), 36 queries , Gzip On.

Powered by Discuz!

© 2001-2012 Comsenz Inc. style by eisdl

回頂部