PHP System Flow Analysis Program _php Tutorial

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 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 ' ' Echo ' "While ($row =mysql_fetch_object ($result)) {echo ' '; Echo ' '; Echo ' '; Echo ' '; Echo ' ' Echo ' ";} echo "
IP Address Recent Time Number User Information
'. $row->ip. ''. Date ("H:i:sa", $row->stime). ''. $row->visits. ''. $row->info. '
";
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 ...

  • Related Article

    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.