//--------------------------------------------------------// // PHP + Flash記數器 // // 作者:旅行 http://phpiscool.yeah.net // // 歡迎訪問PHPisCool.yeah.net // // Copyright 2001 PHPisCOOL - All Rights Reserved // // 拜托,請尊重勞動成果,請保留上述信息 // // 程序參考 韓國 Flash記數器 // //--------------------------------------------------------// include("conn/db_conn.php"); $today = date("d",mktime(date("H"))); //$t_now = time(); //$t_array = getdate($t_now); //$today = $t_array['mday']; mysql_select_db($database_conndigiBoard, $conndigiBoard); $SQLStr = "SELECT * FROM count"; $res = mysql_query($SQLStr); $row = mysql_fetch_array($res); $total_c=$row['total_c']; $yesterday_c=$row['yesterday_c']; $today_c=$row['today_c']; $lastday_c=$row['lastday_c']; //echo " total=".$total_c; //echo " yesterday=".$yesterday_c; //echo " today_c=".$today_c; //echo " lastday=".$lastday_c; //echo " today=".$today; if ($today != $lastday_c) { $yesterday_c = $today_c; $today_c = 0; $lastday_c = $today; //echo " lastday=".$lastday_c; } session_start(); if (!isset($_SESSION['Counter'])){ $total_c++; $today_c++; $_SESSION['Counter']=1; } $total_c = sprintf("%07d", $total_c); $today_c = sprintf("%07d", $today_c); $yesterday_c = sprintf("%07d", $yesterday_c); $insertSQL = sprintf("UPDATE count SET total_c=%s, yesterday_c=%s, today_c=%s, lastday_c=%s WHERE id_c=1",$total_c ,$yesterday_c ,$today_c ,$lastday_c); $Result1 = mysql_query($insertSQL, $conndigiBoard) or die(mysql_error()); ?>