關於會員登入積分系統

目前的code如下
<?php
session_start();

//檢查是否有接收到輸入表單之值
if(isset($_POST["account"]))
$Account = $_POST["account"];
if(isset($_POST["password"]))
$Password = $_POST["password"];

//帳號與密碼輸入不可為空值
if($Account != "" && $Password != ""){

//使用函式庫與資料庫連結
$Connect = connectDatabase();
$Database = "webdb";

//查詢資料庫內是否有對應的會員帳號
$SQL = "SELECT * FROM webtable WHERE account = '$Account' AND password = '$Password'";
$Result = mysql_db_query($Database,$SQL);
if(mysql_fetch_row($Result) != 0){

//取出會員當前積分
$Result = mysql_db_query($Database,$SQL);
$Integral = mysql_result($Result,0,"integral");

//登入成功則積分+1

if($Integral<=10000){
$Integral +=1;
}

//更新會員積分
$SQL_Update = "UPDATE webtable SET integral = '$Integral' WHERE account = '$Account'";
mysql_db_query($Database,$SQL_Update);

//查詢會員對應ID
$ID = mysql_result($Result,0,"ID");

//查積分
$Result_Integral = mysql_db_query($Database,$SQL);
$Integral = mysql_result($Result_Integral,0,"integral");

//查到則存入$_SESSION中
$_SESSION["ID"] = $ID;
$_SESSION["account"] = $Account;
$_SESSION["password"] = $Password;
$_SESSION["integral"] = $Integral;
header("Location:index.php");
}
}
?>

請問如何設定成每12小時登入獲取一次積分呢?

評論

Sign In or Register to comment.