?? view.php
字號:
<? include "./db_mysql.inc" ;$subtypename[0]="graphics arts (圖像藝術)";$subtypename[1]="paintings (繪畫)";$subtypename[2]="reading & writing (閱讀寫作)";$subtypename[3]="photography (攝影)";$subtypename[4]="personal finance (個人理財)";$subtypename[5]="career (事業)";$subtypename[6]="employment (求職廣場)";$subtypename[7]="realty (房地產)";$subtypename[8]="stocks (股市)";$subtypename[9]="Internet (互聯網)";$subtypename[10]="Programming (程式設計)";$subtypename[11]="PC (個人電腦)";$subtypename[12]="Mac (蘋果電腦)";$subtypename[13]="Telecommunication (電子通訊)";$subtypename[14]="Primary School (小學)";$subtypename[15]="Secondary School (中學)";$subtypename[16]="University (大學)";$subtypename[17]="Training (專業訓練)";$subtypename[18]="Movies (電影)";$subtypename[19]="Music (音樂)";$subtypename[20]="Comics (漫畫)";$subtypename[21]="Games (游戲)";$subtypename[22]="Stars (明星)";$subtypename[23]="healthy living (健康生活)";$subtypename[24]="exercise & fitness (強身健體)";$subtypename[25]="soccer (足球)";$subtypename[26]="basketball (籃球)";$subtypename[27]="car racing (賽車)";$subtypename[28]="racing (賽馬)";$subtypename[29]="bridge (棋牌)";$subtypename[30]="fashion (時裝)";$subtypename[31]="cuisine (飲食)";$subtypename[32]="travel (旅游)";$subtypename[33]="romance (愛情)";$shortsubtypename[0]="acga";$shortsubtypename[1]="acpa";$shortsubtypename[2]="acrw";$shortsubtypename[3]="acph";$shortsubtypename[4]="bmpf";$shortsubtypename[5]="bmca";$shortsubtypename[6]="bmem";$shortsubtypename[7]="bmre";$shortsubtypename[8]="bmst";$shortsubtypename[9]="ctin";$shortsubtypename[10]="ctpr";$shortsubtypename[11]="ctpc";$shortsubtypename[12]="ctma";$shortsubtypename[13]="ctte";$shortsubtypename[14]="edps";$shortsubtypename[15]="edss";$shortsubtypename[16]="edun";$shortsubtypename[17]="edtr";$shortsubtypename[18]="enmo";$shortsubtypename[19]="enmu";$shortsubtypename[20]="enco";$shortsubtypename[21]="enga";$shortsubtypename[22]="enst";$shortsubtypename[23]="hehl";$shortsubtypename[24]="heef";$shortsubtypename[25]="spso";$shortsubtypename[26]="spgo";$shortsubtypename[27]="spcr";$shortsubtypename[28]="sphr";$shortsubtypename[29]="spmj";$shortsubtypename[30]="lifa";$shortsubtypename[31]="licu";$shortsubtypename[32]="litr";$shortsubtypename[33]="liro"; if (!isset($uid)) die("<p align=center>所需參數沒有傳遞</p>"); $newdb=new DB_Sql; $sqlstr="select * from stat where uid='$uid'"; $result=$newdb->query($sqlstr); if (!$result) die("查詢:$sqlstr 有錯"); if (($rows=$newdb->num_rows())<=0) die("該用戶沒有統計信息!"); else { $newdb->next_record(); $countresult[0]=$newdb->Record["id"]; $countresult[1]=$newdb->Record["uid"]; $countresult[2]=$newdb->Record["starttime"]; $countresult[3]=$newdb->Record["totalhits"]; $countresult[4]=$newdb->Record["sitetype"]; $countresult[5]=$newdb->Record["maxhits"]; $countresult[6]=$newdb->Record["todayhits"]; //-------------取得站點類型------------------------- $i=0; while($i<34){ if (strcmp($shortsubtypename[$i],$countresult[4])==0){ $typename=$subtypename[$i]; break; } $i+=1; } if ($i==34) $typename="未知"; //------------ 計算統計天數------------------------- $myear=substr($countresult[2],'0',4); $mmonth=substr($countresult[2],'5',2); $mday=substr($countresult[2],'8',2); $mhour=substr($countresult[2],'11',2); $mmin=substr($countresult[2],'14',2); $msec=substr($countresult[2],'17',2); $countresult[2]="$myear-$mmonth-$mday"; $stardate=getdate(mktime(0,0,0,$mmonth,$mday,$myear)); $mtoday=getdate(time()); // $mtoday=getdate(mktime(0,0,0,5,$mday,2001)); $days=($mtoday["year"]-$stardate["year"])*365+($mtoday["yday"]-$stardate["yday"]); //------------計算平均每天瀏覽量---------------------- if ($days!=0) $perdayhits=round($countresult[3]/$days); else $perdayhits=$countresult[6]; //-----------得到用戶的郵件和名字 站名 url---------------------- $sqlstr="select username,curr_email,title from userinfo where uid=$uid"; $result=$newdb->query($sqlstr); if (!$result) die("查詢:$sqlstr 有錯"); else { if (($rows=$newdb->num_rows())>0){ $newdb->next_record(); $username=$newdb->Record["username"]; $email=$newdb->Record["curr_email"]; $webname=$newdb->Record["title"]; } } //-----------計算在同類網站中目前排名----------------- $sqlstr="select count(*) from stat where totalhits>".$countresult[3]." and sitetype='".$countresult[4]."'"; if (($result=$newdb->query($sqlstr))){ $newdb->next_record(); $order=$newdb->Record[0]; } $order+=1; //----------計算在所有網站中得排名-------------------- $sqlstr="select count(*) from stat where totalhits>".$countresult[3]; // echo($sqlstr); // echo($countresult[3]); if (($result=$newdb->query($sqlstr))){ $newdb->next_record(); $totalorder=$newdb->Record[0]; } $totalorder+=1; //-----------預計本日瀏覽人數----------------------- if (( $mtoday["hours"]*60+$mtoday["minutes"])!=0) $pdayhits=intval($countresult[6]/( $mtoday["hours"]*60+$mtoday["minutes"])*24*60); else $pdayhits=$perdayhits; } //-----------讀取最近25位訪問者-------------------- $sqlstr="select * from statdetail where uid='$uid' order by date desc"; if (($result=$newdb->query($sqlstr))){ $clientnum=$newdb->num_rows(); if ($clientnum>25) $clientnum=25; $i=0; while (($newdb->next_record()) and $i<$clientnum){ $client[$i][0]=$newdb->Record["Date"]; $myear=substr($client[$i][0],'0',4); $mmonth=substr($client[$i][0],'5',2); $mday=substr($client[$i][0],'8',2); $mhour=substr($client[$i][0],'11',2); $mmin=substr($client[$i][0],'14',2); $msec=substr($client[$i][0],'17',2); $client[$i][0]="$myear-$mmonth-$mday"; $client[$i][1]="$mhour:$mmin:$msec"; $client[$i][2]=$newdb->Record["IP"]; $client[$i][3]=$newdb->Record["Browser"]; // echo $newdb->Record["Browser"]; // echo $client[$i][3]; $client[$i][4]=$newdb->Record["Os"]; $client[$i][4]=$newdb->Record["Os"]; $i+=1; } }?><html><head><title>中華網---個人主頁統計</title><style type="text/css"><!--body.t{ font-family: "宋體", "Arial", "Times New Roman"; font-size: 9pt; line-height: 150%; letter-spacing: 1px}.tt3{ font-family: "!宋體", "!Arial", "!Times New Roman"; font-size:11pt; line-height: 130%; color: #000000;}a:hover {color:red;text-decoration:underline}--></style></head><body class="tt3"><div align="center"><center><table border="0" width="513" bgcolor="#FCFDDB" cellspacing="0"cellpadding="2" class="tt3"> <tr> <td width="18" height="86"></td> <td width="462" height="86" valign="top"><p align="center"><img src="logohome.gif" width="303" height="84" alt="logohome.gif (6077 bytes)"></td> <td width="29" height="86"></td> </tr> <tr> <td width="18" height="28"></td> <td width="511" height="28" valign="top"> <p align="center"> <a href="hourstat.php?uid=<? echo $uid;?>">小時統計</a> <a href="daystat.php?uid=<? echo $uid;?>">日統計</a> <a href="weekstat.php?uid=<? echo $uid;?>">周統計</a> <a href="monthstat.php?uid=<? echo $uid;?>">月統計</a> </font></td> <td width="29" height="28"></td> </tr> <tr> <td width="18" height="28"></td> <td width="511" height="28" valign="top"> <p align="center">站名: <? echo $webname; ?> 站長: <a href="mailto:<? echo $email;?>"><? echo $username; ?></a> <td width="29" height="28"></td> </tr> <tr> <td width="18" rowspan="2"></td> <td width="462" valign="top"><table border="0" cellPadding="2" width="100%" cellspaccing="2"><TBODY> <tr> <td><table class="tt3" border="1" borderColor="#336600" cellPadding="0" cellSpacing="0" width="100%"><TBODY> <tr> <td><table class="tt3" border="0" cellPadding="3" cellSpacing="0" width="100%"><TBODY> <tr bgColor="#336600"> <td align="middle" bgColor="#336600" colSpan="2" width="100%"><font color="#ffffff">綜 合 數 據</font></td> </tr> <tr bgColor="#cccccc"> <td align="left" width="60%"><p class="sureyeah">開始統計日期 </td> <td align="right" width="40%"><font color="#336699" ><? echo($countresult[2]); ?> </font></td> </tr> <tr bgColor="#ffffff"> <td align="left" width="60%">總統計天數</td> <td align="right" width="40%"><font color="#336699" ><? echo($days); ?></font></td> </tr> <tr bgColor="#cccccc"> <td align="left" width="60%">總瀏覽人數</td> <td align="middle" width="40%"><p align="right"><font color="#336699" ><? echo($countresult[3]); ?></font></td> </tr> <tr bgColor="#ffffff"> <td align="left" width="60%">平均每天訪問人數</td> <td align="right" width="40%"><font color="#336699" ><? echo( $perdayhits); ?></font></td> </tr> <tr bgColor="#cccccc"> <td align="left" width="60%">站點性質</td> <td align="right" width="40%"><font color="#336699" ><? echo($typename); ?></font></td> </tr> <tr bgColor="#ffffff"> <td align="left" width="60%">目前總排名</td> <td align="right" width="40%"><font color="#336699" >第 <? echo($totalorder); ?> 名</font></td> </tr> <tr bgColor="#cccccc"> <td align="left" width="60%">目前同類站點中排名</td> <td align="right" width="40%"><font color="#336699" >第 <? echo($order); ?> 名</font></td> </tr> <tr bgColor="#ffffff"> <td align="left" width="60%">今日總瀏覽人數</td> <td align="right" width="40%"><font color="#336699" ><? echo($countresult[6])?></font></td> </tr> <tr bgColor="#cccccc"> <td align="left" width="60%">預計本日瀏覽人數</td> <td align="right" width="40%"><font color="#336699" ><? echo($pdayhits); ?></font></td> </tr> <tr bgColor="#ffffff"> <td align="left" width="60%">最高一天瀏覽量</td> <td align="right" width="40%"><font color="#336699" ><? echo($countresult[5]) ;?></font></td> </tr></TBODY> </table> </td> </tr></TBODY> </table> </td> </tr> </table> </td> <td width="29" height="60" rowspan="2"></td> </tr> <tr> <td width="462"><table class="tt3" border="1" borderColor="#336600" cellPadding="0" cellSpacing="0" width="100%"><TBODY> <tr> <td><table class="tt3" border="0" cellPadding="1" cellSpacing="0" height="155" width="100%"><TBODY> <tr> <td colspan="6" align="middle" bgColor="#336600" colSpan="5" width="100%"><font color="#ffffff"><? echo ("最 后 ".$clientnum." 位 訪 問 者");?></font></td> </tr> <tr bgColor="#cccccc"> <td align="middle">日期</td> <td align="left"><p align="center">時間</td> <td align="left"><p align="enter">訪客IP</td> <td align="left"><p align="center">瀏覽器</td> <td align="right"><p align="center">操作系統</td> </tr> <? $i=0; ?> <? while($i<$clientnum) {?> <tr bgColor="#ffffff"> <td align="middle" noWrap ><? echo $client[$i][0]; ?></td> <td align="left" noWrap ><p align="left"><? echo $client[$i][1]; ?></td> <td align="left" noWrap ><p align="left"><font color="#000000"><? echo $client[$i][2]; ?></font></td> <td align="left" noWrap ><p align="left"><font color="#336699"><? echo $client[$i][3]; ?></font></td> <td align="middle" noWrap ><? echo $client[$i][4]; ?></td> </tr> <? $i+=1; } ?></TBODY> </table> </td> </tr></TBODY> </table> </td> </tr> <tr> <td height="28" width="18"></td> <td height="28" width="462"></td> <td height="28" width="29"></td> </tr></table></center></div></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -