> Create table stream (
Ip text,
STime int,
Visits int,
Info text );
<?
If ($ day <0) $ day = 0;
$ Mlink = mysql_connect ('localhost', 'Ajax ', 'xxxxxxx ');
// Count the total number of times the home page has been browsed so far
$ Query = "select SUM (visits) as tvisits from stream ";
$ Result = mysql_db_query ('Ajax ', $ query, $ mlink );
Echo '<span class = "st1"> Total times of browsing the home page :';
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 '<p> ';
$ Ctime1 = time ()-24X3600 * $ I;
$ Ctime2 = time ()-24*3600 * ($ i-1 );
Echo '<span class = "st4"> date:'. date ("m Month 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, date (m, $ ctime2), date (d, $ ctime2), date (Y, $ ctime2 ));
// Count the total number of times the homepage is browsed on the current day
$ 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"> accumulated times of browsing the home page :';
If ($ row = mysql_fetch_object ($ result )){
Echo $ row-> tvisits;
}
// Count the number of ip addresses visited on the current day
$ Query = 'select * from stream where sTime> = '. $ stoday1;
$ Query. = 'and sTime <'. $ stoday2. 'Order by sTime DESC ';
$ Result = mysql_db_query ('Ajax ', $ query, $ mlink );
Echo"
Total browsing count: ". mysql_num_rows ($ result );
Echo '</span> Echo '<table border = "0" width = "100%" cellspacing = "0" cellpadding = "2" class = "st3"> ';
Echo '<tr> <td nowrap class = "st2"> IP address </td>
<Td nowrap class = "st2"> last time </td>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.