Create a file as follows. Connect to the database in step 1st, write the file, and then read it.
CopyCode The Code is as follows: <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?
$ Mysql_server_name = "localhost ";
$ Mysql_username = "root ";
$ Mysql_password = "";
$ Mysql_database = "DB ";
// Capture IP addresses
$ IP = getenv ("remote_addr ");
// Establish a line-through (servo server location, user name, user password)
$ Conn = mysql_connect ($ mysql_server_name, $ mysql_username, $ mysql_password );
// Prepare SQL syntax. This syntax is newly added.
$ SQL = "insert into 'num' ('name', 'IP', 'new') values ('badwolf ',' $ ip', '1 ');";
// Select the database you want to process
Mysql_select_db ($ mysql_database, $ conn );
// Query
$ Result = mysql_query ($ SQL );
// Result and release the link
Mysql_close ($ conn );
//------------------------------------------------------------------
// Print the following information
// establish a connection (servo server location, user name, user password)
$ conn = mysql_connect ($ mysql_server_name, $ mysql_username, $ mysql_password );
// prepare the SQL syntax. This syntax reads data.
$ SQL = "select count (*) from 'num' where name = 'badwolf '";
// query
$ result = mysql_db_query ($ mysql_database, $ SQL, $ conn );
// capture the query result
$ ROW = mysql_fetch_row ($ result );
// print all columns of the Data
// print_r ($ row);
// clear the query result
mysql_fre E_result ($ result);
?>
Bad Wolf security net PHP counter
<Body>
<Div align = "center" class = "style1">
<P> Bad Wolf security net PHP counter </P>
<H1> <SPAN class = "style3"> <? = $ Row [0];?> </Span> Number of people </Div>
</Body>
</Html>