<?
//------[ 基本設定 ]-------
$mysql_server_name = "localhost";
$mysql_username = "root";
$mysql_password = "512783";
$mysql_database = "jishuqi";
//-------
//准備好你的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);
//建立連接------通過(伺服器地址,使用者名稱,使用者密碼)
$conn=mysql_connect( $mysql_server_name, $mysql_username, $mysql_password );
//准備好你的SQL語法
$sql = "SELECT COUNT(*) FROM `counter_1`";
//進行查詢(或者叫做執行,選取)
$result=mysql_db_query( $mysql_database, $sql,$conn );
//將查詢後的結果-->抓出一筆
$row1=mysql_fetch_row($result);
//印出該筆資料的所有欄位的陣列
//print_r($row1);
//清除查詢結果
mysql_free_result($result);
//建立連接------通過(伺服器地址,使用者名稱,使用者密碼)
$conn=mysql_connect( $mysql_server_name, $mysql_username, $mysql_password );
//准備好你的SQL語法
$sql = "SELECT COUNT(*) FROM `counter_1` WHERE user='$user'";
//進行查詢(或者叫做執行,選取)
$result=mysql_db_query( $mysql_database, $sql,$conn );
//將查詢後的結果-->抓出一筆
$row2=mysql_fetch_row($result);
//印出該筆資料的所有欄位的陣列
//print_r($row2);
//清除查詢結果
mysql_free_result($result);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>3種計數器</title>
<style type="text/css">
<!--
.style1 {
font-size: 24px;
color: #00FF99;
}
.style2 {color: #FF00FF}
.style3 {color: #CC0033}
.style4 {color: #0000FF}
.style5 {color: #FF0000}
.style6 {
font-size: 36px;
color: #996633;
}
-->
</style>
</head>
<body>
<div align="center" class="style1 style6">楓樹林下
</div>
<div align="center">
<p class="style1"> </p>
<p class="style1"> </p>
<p class="style1"><span class="style3">總共有</span><?=$row1[0]; ?><span class="style5">人</span><span class="style4">來過</span><span class="style2">這個網站
</span></p>
<p class="style1"><span class="style3">總共有</span><?=$row2[0]; ?><span class="style5">人</span><span class="style4">來過</span><span class="style2"><?=$user?>網站
</span>
</p>
</div>
</body>
</html>
當前1/2頁 12下一頁閱讀全文