Chinaunix首页 | 论坛 | 博客
  • 博客访问: 18672573
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类:

2008-05-29 10:04:51


>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); phperz~com

echo '浏览首页总累积次数:';
if($row=mysql_fetch_object($result)){
echo $row->tvisits;
} php程序员站

$week=array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
for($i=0;$i<=$day;$i++){
echo '

';
$ctime1=time()-24*3600*$i;
$ctime2=time()-24*3600*($i-1);
echo '日期:'.date("m月d日",$ctime1).$week[date("w",$ctime1)];
echo "
";

php程序员站

$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 '浏览首页累积次数:';
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);

www~phperz~com

echo "
浏览总人数:".mysql_num_rows($result);
echo '


';
echo '';
echo '


';
echo ""; php程序员站

while($row=mysql_fetch_object($result)){
echo '

';
echo '';
echo '';
echo '';
echo '';
echo " ";
}
echo "
IP位址最近时间次数用户资讯
'.$row->ip.''.date("h:i:sa",$row->sTime).''.$row->visits.''.$row->info.'
";
echo '
';
}
mysql_close($mlink);
?> phperz.com

阅读(359) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~