- 註冊時間
- 2002-7-24
- 線上時間
- 48 小時
- 閱讀權限
- 255
- 積分
- 783
- 主題
- 139
- 精華
- 5
- 文章
- 555
該用戶從未簽到 - 文章
- 555
|
範例演示:
++++++++++++++++++++++++++++++++++
安裝方法:
++++++++++++++++++++++++++++++++++
把以下代碼存成 statspng.php ,儲存後放到論壇的根目錄。
- <?php
- /*
- [DISCUZ!] statspng.php - board images statistics
- This is NOT a freeware, use is subject to license terms
- Version: 2.0.0
- Author: Loveyuki ([email]webmaster@loveyuki.com[/email])
- Copyright: Soar Computer Studio (www.loveyuki.com)
- Last Modified: 2003/10/6 17:00
- */
- define('IN_DISCUZ', TRUE);
- Header("Content-type: image/PNG");
- require 'config.php';
- require 'include/db_'.$database.'.php';
- $tables = array('members', 'posts', 'sessions', 'stats');
- foreach($tables as $tablename) {
- ${'table_'.$tablename} = $tablepre.$tablename;
- }
- unset($tablename);
- $db = new dbstuff;
- $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
- $db->select_db($dbname);
- unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
- $query = $db->query("SELECT count,type,var FROM $table_stats WHERE type='".total."' and var='".hits."'");
- $stats = $db->fetch_array($query);
- $stats = $stats['count'];
- $query = $db->query("SELECT count(*) FROM $table_members");
- $members = $db->result($query,0);
- $query = $db->query("SELECT count(*) FROM $table_posts");
- $posts = $db->result($query,0);
- $query = $db->query("SELECT count(*) FROM $table_sessions");
- $online = $db->result($query,0);
- if(getenv('HTTP_CLIENT_IP')) {
- $onlineip = getenv('HTTP_CLIENT_IP');
- } elseif(getenv('HTTP_X_FORWARDED_FOR')) {
- $onlineip = getenv('HTTP_X_FORWARDED_FOR');
- } elseif(getenv('REMOTE_ADDR')) {
- $onlineip = getenv('REMOTE_ADDR');
- } else {
- $onlineip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
- }
- $currenttime = date("Y-m-d A");
- $im = @imagecreatefromgif("images/statspng.gif");
- $white = ImageColorAllocate($im, 255,255,255);
- $black = ImageColorAllocate($im, 0,0,0);
- imagestring($im, 3, 138, 2, $stats, $black);
- imagestring($im, 3, 137, 1, $stats, $white);
- imagestring($im, 3, 138, 17, $posts, $black);
- imagestring($im, 3, 137, 16, $posts, $white);
- imagestring($im, 3, 138, 32, $members, $black);
- imagestring($im, 3, 137, 31, $members, $white);
- imagestring($im, 3, 265, 2, $onlineip, $black);
- imagestring($im, 3, 264, 1, $onlineip, $white);
- imagestring($im, 3, 265, 17, $online, $black);
- imagestring($im, 3, 264, 16, $online, $white);
- imagestring($im, 3, 265, 32, $currenttime, $black);
- imagestring($im, 3, 264, 31, $currenttime, $white);
- ImagePNG($im);
- ImageDestroy($im);
- ?>
複製代碼
再把附件的圖另存新檔後,修改您的站名,存到圖檔根目錄中。
[ Last edited by jamesanna on 2003-10-7 at 06:37 ] |
|