Re: [問題] 限定時間過後即關閉系統的程式
現在大致做出來了
不過..最後不能重新導向到index1.php = =
可以幫我看一下哪裡有問題嗎
<?php
$passed = $_COOKIE["passed"];
if ($passed != "TRUE")
{ header("location:project.htm");
exit();
}
$link = mysql_connect("localhost", "root", "321");
if (!$link) die("建立資料連接失敗");
$db_selected = mysql_select_db("ball game", $link);
if (!$db_selected) die("開啟資料庫失敗");
$sql = "SELECT * FROM setdate";
$result = mysql_query($sql, $link);
if (!$result) die("執行 SQL 命令失敗");
if (mysql_num_rows($result) != 0)
{ $row = mysql_fetch_array($result, MYSQL_ASSOC);
$timestamp1 = mktime($row["starthour"],0,0,$row["startmonth"],
$row["startday"],$row["startyear"]);
$timestamp2 = mktime($row["closinghour"],0,0,$row["closingmonth"]
,$row["closingday"],$row["closingyear"]);
}
mysql_free_result($result);
mysql_close($link);
if(time()<$timestamp1) exit('尚未開放');
else if(time()>$timestamp2) exit('期限已過');
if(time()>$timestamp1 && time()<$timestamp2)
header("Location:index1.php");
--
※ 發信站: 批踢踢實業坊(ptt.cc)
※ 編輯: noguchi 來自: 203.64.183.199 (08/22 15:16)
→
08/22 16:13, , 1F
08/22 16:13, 1F
→
08/22 17:18, , 2F
08/22 17:18, 2F
→
08/22 17:23, , 3F
08/22 17:23, 3F
→
08/22 17:25, , 4F
08/22 17:25, 4F
※ 編輯: noguchi 來自: 203.64.183.208 (08/23 11:40)
討論串 (同標題文章)
完整討論串 (本文為第 4 之 4 篇):
4
10
PHP 近期熱門文章
PTT數位生活區 即時熱門文章