⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 view.php

📁 一个用java编译的流量统计系统
💻 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>&nbsp;   <a href="daystat.php?uid=<? echo $uid;?>">日统计</a>&nbsp;   <a href="weekstat.php?uid=<? echo $uid;?>">周统计</a>&nbsp;   <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; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    站长:   <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 + -