>create Table Stream (
IP text,
stime int,
visits int,
info text);
if ($day <0) $day = 0;
$mlink =mysql_connect (' localhost ', ' Ajax ', ' xxxxxxx ');
Statistics so far the total number of pages viewed
$query = "Select SUM (visits) as tvisits from stream";
$result =mysql_db_query (' Ajax ', $query, $mlink);
Echo ' Browse Home total Cumulative number of times: ';
if ($row =mysql_fetch_object ($result)) {
Echo $row->tvisits;
}
$week =array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
for ($i =0; $i <= $day; $i + +) {
Echo '
';
$ctime 1=time () -24*3600* $i;
$ctime 2=time () -24*3600* ($i-1);
Echo ' date: '. Date ("M-D Day", $ctime 1). $week [Date ("W", $ctime 1)];
echo "";
$stoday 1=mktime (0,0,0,date (M, $ctime 1), date (d, $ctime 1), date (Y, $ctime 1));
$stoday 2=mktime (0,0,0,date (M, $ctime 2), date (d, $ctime 2), date (Y, $ctime 2));
Count the number of times the page was browsed on the day
$query = ' Select SUM (visits) as tvisits from stream where stime>= ';
$query. = $stoday 1. ' and stime< '. $stoday 2;
$result =mysql_db_query (' Ajax ', $query, $mlink);
Echo ' Browse home cumulative number of times: ';
if ($row =mysql_fetch_object ($result)) {
Echo $row->tvisits;
}
Count the number of visited IPs on the day
$query = ' SELECT * from stream where stime>= '. $stoday 1;
$query. = ' and stime< '. $stoday 2. ' ORDER by stime DESC ';
$result =mysql_db_query (' Ajax ', $query, $mlink);
echo "
Total number of visitors: ". mysql_num_rows ($result);
Echo '
';
Echo '
'; Echo '
IP Address |
Recent Time |
Number |
User Information | ' Echo '
"While ($row =mysql_fetch_object ($result)) {echo '
'; Echo '
'. $row->ip. ' | '; Echo '
'. Date ("H:i:sa", $row->stime). ' | '; Echo '
'. $row->visits. ' | '; Echo '
'. $row->info. ' | ' Echo '
";} echo "
";
Echo ' ';
}
Mysql_close ($mlink);
?>
http://www.bkjia.com/PHPjc/315149.html www.bkjia.com true http://www.bkjia.com/PHPjc/315149.html techarticle CREATE TABLE Stream (IP text, stime int, visits int, info text); if ($day 0) $day =0; $mlink =mysql_connect (' localhost '), ' Ajax ', ' xxxxxxx '); Statistics so far the total number of pages viewed $q ...