|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我的文章不会对您的学习起到实质性的作用,您能否成功,还得靠自己的,坚持,坚持,再坚持,就是步入成功的不二法门。法式|流量 >create table stream (
ip text,
sTime int,
visits int,
info text);
<?
if($day<0)$day=0;
$mlink=mysql_connect('localhost','ajax','xxxxxxx');
//统计至今首页被阅读的总次数
$query="select SUM(visits) as tvisits from stream";
$result=mysql_db_query('ajax',$query,$mlink);
echo '<span class="st1">阅读首页总积累次数:';
if($row=mysql_fetch_object($result)){
echo $row->tvisits;
}
$week=array("日曜日","礼拜一","礼拜二","礼拜三","木曜日","礼拜五","礼拜六");
for($i=0;$i<=$day;$i++){
echo '<p>';
$ctime1=time()-24*3600*$i;
$ctime2=time()-24*3600*($i-1);
echo '<span class="st4">日期:'.date("m月d日",$ctime1).$week[date("w",$ctime1)];
echo "</span>";
$stoday1=mktime(0,0,0,date(m,$ctime1),date(d,$ctime1),date(Y,$ctime1));
$stoday2=mktime(0,0,0,date(m,$ctime2),date(d,$ctime2),date(Y,$ctime2));
//统计当日首页被阅读的积累次数
$query='select SUM(visits) as tvisits from stream where sTime>=';
$query.=$stoday1.' and sTime<'.$stoday2;
$result=mysql_db_query('ajax',$query,$mlink);
echo '<span class="st3">阅读首页积累次数:';
if($row=mysql_fetch_object($result)){
echo $row->tvisits;
}
//统计当日访问ip的数目
$query='select * from stream where sTime>='.$stoday1;
$query.=' and sTime<'.$stoday2.' order by sTime DESC';
$result=mysql_db_query('ajax',$query,$mlink);
echo "
阅读总人数:".mysql_num_rows($result);
echo '</span><hr size="1">';
echo '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="st3">';
echo '<tr><td nowrap class="st2">IP位址</td>
<td nowrap class="st2">比来工夫</td>
<td nowrap class="st2">次数</td>
<td nowrap class="st2">用户新闻</td>';
echo "</tr>";
while($row=mysql_fetch_object($result)){
echo '<tr>';
echo '<td nowrap>'.$row->ip.'</td>';
echo '<td nowrap>'.date("h:i:sa",$row->sTime).'</td>';
echo '<td nowrap>'.$row->visits.'</td>';
echo '<td nowrap>'.$row->info.'</td>';
echo "</tr> ";
}
echo "</table>";
echo '<hr size="1">';
}
mysql_close($mlink);
?>
会HTML吗?会,我能编好几个大表格排板的网页啦! |
|