下面是我当时写的部分代码,希望对您有用。
- <?php
- header("Content-Type: text/vnd.wap.wml;charset=gb2312");
- echo '<?xml version="1.0" encoding="UTF-8"?>';
- echo '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">';
- ?>
- <wml>
- <card id="main" title="宣城论坛">
- <p>
- <?php
- define('IN_DISCUZ', TRUE);
- require './include/db_mysql.php';
- $db = new dbstuff;
- $db->connect('localhost', 'root','9999999999999', 'enhand',1);
- $db->select_db('enhand');
- $onlinenum=0;
- $mylen1=20;
- /*
- $current = time();
- $app_mintime = 100;
- $app_maxtime = 600;
- $randtime = mt_rand($app_mintime, $app_maxtime);
- $onlinesid = random(6);
- $onlinetime = $current - $randtime;
- //$db->query("INSERT INTO cdb_sessions (sid,username,ip1, groupid, styleid, lastactivity, action, fid ) VALUES ('$onlinesid','手机用户','000' ,'1', '1','$onlinetime','2','47')");
- */
- $query = $db->query("SELECT COUNT(*) FROM cdb_sessions");
- $onlinenum = $db->result($query, 0);
- $onlinenum++;
- $query = $db->query("SELECT fid,type,name FROM cdb_forums WHERE status='1' and type='forum' and fid!=61 and fid!=81 and fid!=60 order by displayorder;");
- $alltopic='<a href="wonline.php">在线'.$onlinenum.'人</a><br/>';
- $pid="";
- $Letsgo="";
- while($memberinfo = $db->fetch_array($query))
- {
- if((strpos($memberinfo['name'],'<')=== false)&&(strpos($memberinfo['name'],'>')=== false))
- {
- $pid=$memberinfo['fid'];
- $d1=substr($memberinfo['name'],0,$mylen1);
- $Letsgo='<a href="thwap.php?id='.$pid.'">'.$d1.'</a>';
- $alltopic=$alltopic.$Letsgo." <br/>";
- }
- }
- ?>
- <?php
- //$alltopic="论坛测试";
- echo($alltopic);
- ?>
- </p>
- </card>
- </wml>
复制代码 |