PHP system Flow Analysis of the program _php Foundation

Source: Internet
Author: User
>create Table Stream (
IP text,
stime int,
visits int,
info text);
?
if ($day <0) $day = 0;
$mlink =mysql_connect (' localhost ', ' Ajax ', ' xxxxxxx ');
Statistics to date the total number of pages browsed
$query = "Select SUM (visits) as tvisits from stream";
$result =mysql_db_query (' Ajax ', $query, $mlink);

Echo ' <span class= "St1" > browse the total cumulative number of pages: ';
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> ';
$ctime 1=time () -24*3600* $i;
$ctime 2=time () -24*3600* ($i-1);
Echo ' <span class= "St4" > Date: '. Date ("M-month D-Day", $ctime 1). $week [Date ("W", $ctime 1)];
echo "</span>";

$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 cumulative number of pages browsed on the same 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 ' <span class= "ST3" > Browse homepage Cumulative number of times: ';
if ($row =mysql_fetch_object ($result)) {
Echo $row->tvisits;
}
Count the number of IP calls 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 visitors: ". 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 site </td>
&LT;TD nowrap class= "St2" > Recent time </td>
&LT;TD nowrap class= "St2" > Times </td>
&LT;TD nowrap class= "ST2" > User information </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 ' }
Mysql_close ($mlink);
?>


Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.