Ben Program There are 4 counters.
Index. php is a common counter that shows the total number of times and the number of people who come to the site. It is not waterproof when you click a few times.
Index1.php is also a waterproof counter that shows the number of times and the number of people who come to the site. It is waterproof and can be added once every 5 seconds.
Index2.php is a waterproof counter that shows the total number of times and the number of people who come to the site. The number of times points is added several times, which is waterproof and can be added once in 2 seconds.
Indexa. PHP is a common, waterproof, and graphic counter in three-in-one. We can see the total number of times and the number of people who came to the site, which is waterproof and graphic.
Key statement:
Waterproof: $ SQL = "select count (*) from 'counter _ 1' where user = '$ user' and time_to_sec (now ()-'time ') <5 and IP = '$ remote_addr '";
Graphic counters: For ($ I = 0; $ I <strlen ($ row [0]); $ I ++)
{
$ Digit = substr ($ row [0], $ I, 1 );
$ Pic. = " ";
}
<?
// ------ [Basic settings] -------
$ Mysql_server_name = "localhost ";
$ Mysql_username = "root ";
$ Mysql_password = "512783 ";
$ Mysql_database = "jishuqi ";
//-------
// Prepare your SQL
$ SQL = "insert into 'counter _ 1' ('user', 'IP', 'time') values ('$ user',' $ ip ', now ());";
$ Conn = mysql_connect ($ mysql_server_name, $ mysql_username, $ mysql_password );
Mysql_select_db ($ mysql_database, $ conn );
$ Result = mysql_query ($ SQL );
// $ Id = mysql_insert_id ();
Mysql_close ($ conn );
// Establish a connection ------ pass (server address, user name, user password)
$ Conn = mysql_connect ($ mysql_server_name, $ mysql_username, $ mysql_password );
// Prepare your SQL syntax
$ SQL = "select count (*) from 'counter _ 1 '";
// Query (or execution, select)
$ Result = mysql_db_query ($ mysql_database, $ SQL, $ conn );
// Capture the query result -->
$ Row1 = mysql_fetch_row ($ result );
// Print the array of all columns of the data
// Print_r ($ row1 );
// Clear query results
Mysql_free_result ($ result );
// Establish a connection ------ pass (server address, user name, user password)
$ Conn = mysql_connect ($ mysql_server_name, $ mysql_username, $ mysql_password );
// Prepare your SQL syntax
$ SQL = "select count (*) from 'counter _ 1 'where user =' $ user '";
// Query (or execution, select)
$ Result = mysql_db_query ($ mysql_database, $ SQL, $ conn );
// Capture the query result -->
$ Row2 = mysql_fetch_row ($ result );
// Print the array of all columns of the data
// Print_r ($ row2 );
// Clear query results
Mysql_free_result ($ result );
?>
3 counters
under Maple Forest
total People visited This website
total People come Website