Online User count statistics, daily traffic statistics, and monthly traffic statistics are available .....
<?
$ SQL = "CREATE TABLE guestinfo (ID integer default '0' not null auto_increment,
IPaddress varchar (20 ),
Host varchar (20 ),
Cometime datetime,
Refreshtime datetime,
Leavetime datetime,
Primary Key (ID ),
Unique ID (ID ),
Index guestinfo (ID)
)";
Mysql_query ($ SQL, $ Connect );
?>
<?
$ Duration= 300;
$ SQL = "select * From guestinfo where (leavetime is null or leavetime ='') and (unix_timestamp (now ()-unix_timestamp (refreshtime)> $ duration ";
$ Result = @ mysql_query ($ SQL );
While ($ ROW = @ mysql_fetch_array ($ result ))
{
$ Id = $ row ['id'];
$ SQL = "Update guestinfo set leavetime = now () Where id = '$ id '";
Mysql_query ($ SQL );
}< br> $ SQL = "select * From guestinfo where IPaddress = '$ remote_addr' and (leavetime is null or leavetime = '')";
$ result = @ mysql_query ($ SQL);
if ($ ROW = @ mysql_fetch_array ($ result ))
{< br> $ id = $ row ['id'];
$ SQL = "Update guestinfo set refreshtime = now () where id = '$ id' ";
mysql_query ($ SQL );
}< br> else
{< br> $ SQL = "insert into guestinfo (IPaddress, host, cometime, refreshtime)
values ('$ remote_addr', '$ remote_host', now (), now () ";
mysql_query ($ SQL );
}< br> $ date = mktime (0, 0, 0, date ("M"), date ("D"), date ("Y "));
$ SQL = "select count (*) from guestinfo where unix_timestamp (refreshtime)> $ date";
$ result = mysql_query ($ SQL );
if ($ result)
{< br> $ ROW = mysql_fetch_array ($ result);
$ todayaccess = $ row ["count (*) "];
}< br> else $ todayaccess = 0;
$ SQL = "select count (*) from guestinfo where leavetime is null or leavetime = ''";
$ Result = mysql_query ($ SQL );
If ($ result)
{
$ ROW = mysql_fetch_array ($ result );
$ Nowonline = $ row ["count (*)"];
}
Else $ nowonline = 0;
Mysql_close ($ Connect );
?>
Include ("guest. php ");
<Head>
<Meta http-equiv = "refresh" content = <? Echo $ duration?>; Url = <? Echo $ php_self;?> ">
</Head>
Welcome to my website for watering. If you have any questions, leave a message for me.