& Lt ;? & Nbsp; // require ('Common. inc '); & nbsp; & #36; arr_requestarray (); & nbsp; if (count (& #36; HTTP_GET_VARS) & nbsp; & amp; nbsp; & amp; #123; // Require ('Common. Inc ');
$ Arr_request = array ();
If (count ($ HTTP_GET_VARS ))
{
While (list ($ key, $ value) = each ($ HTTP_GET_VARS ))
{
$ Arr_request [strtolower ($ key)] = $ value;
}
}
If (count ($ HTTP_POST_VARS ))
{
WHILE (list ($ key, $ value) = each ($ HTTP_POST_VARS ))
{
$ Arr_request [strtolower ($ key)] = $ value;
}
}
$ Link = @ MySQL (the best combination with PHP) _ connect ("localhost", "kong", "kong ");
MySQL (the best combination with PHP) _ select_db ("mywebdb ");
$ Ip = $ REMOTE_ADDR;
$ Current = getdate (time ());
$ Day = $ current ["mday"];
$ Query = "select * from addcount where day =" $ day "";
$ Result = @ MySQL (the best combination with PHP) _ query ($ query );
If (! $ Num = @ MySQL (the best combination with PHP) _ num_rows ($ result ))
$ Num = 1;
While ($ row = @ MySQL (the best combination with PHP) _ fetch_row ($ result ))
{
If (strcmp ($ ip, $ row [1]) = 0)
{
$ I = 1;
$ Id = $ row [0];
$ Click = $ row [3] + 1;
$ Up = "update addcount set click_count = click_count + 1 where id = $ id ";
$ Result2 = @ MySQL (the best combination with PHP) _ query ($ up );
// Break;
}
$ Total + = $ row [3];
}
$ Total ++;
If (! $ I ){
$ Query1 = "insert into addcount (ip, day, click_count) values ($ ip, $ day, 1 )";
MySQL (best combination with PHP) _ db_query ("mywebdb", $ query1, $ link );
$ Click = 1;
}
Echo" Counter";
Echo "you are the visitor". $ num ."
";
Echo "today you click". $ click ."
";
Echo "total clicks". $ total. "today
";
/*
Table:
Addcount
Create table addcount (
Id int (6) DEFAULT 0 not null auto_increment,
Ip char (20) not null,
Day int (2) not null,
Click_count int (3) not null,
Prima (the most comprehensive virtual host Management System) ry key (id)
);
*/
?>
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.