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 );
}
$ SQL = "select * from guestinfo where ipaddress = '$ REMOTE_ADDR' and (leavetime is null or leavetime = '')";
$ Result = @ mysql_query ($ SQL );
If ($ row = @ mysql_fetch_array ($ result ))
{
$ Id = $ row ['id'];
$ SQL = "update guestinfo set refreshtime = now () where id = '$ id '";
Mysql_query ($ SQL );
}
Else
{
$ SQL = "insert into guestinfo (ipaddress, host, cometime, refreshtime)
Values ('$ REMOTE_ADDR', '$ REMOTE_HOST', now (), now ())";
Mysql_query ($ SQL );
}
$ 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)
{
$ Row = mysql_fetch_array ($ result );
$ Todayaccess = $ row ["count (*)"];
}
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.