猜到正解後首先會出現這個畫面,會在5秒後自動跳轉到排行榜的頁面:
correct.php
<body>
<div class="flex-center position-ref full-height ">
<div class="top-right home">
<a href="index.php">Restart</a>
<a href="rank.php">RANK</a>
</div>
<div class="content">
<div class="m-b-md">
<div class="title">
<?="Answer Correct, <br> Congratulations ".$name."!!";
echo"<br>You spent ".$spentMin. " minutes and ".$spentSec." seconds.";
header("Refresh:5;url=rank.php");
?>
</div>
</div>
</div>
</body>
</html>
接著進入排行榜,排序參考的是時間(分.秒)+總共猜的次數,由小至大排序:
rank.php
<title>Rank</title>
<body>
<div class="flex-center position-ref full-height ">
<div class="top-right home">
<a href="index.php">Restart</a>
</div>
<div class="contentR m-b-md">
<div class="title">
Rank
</div>
<?php
include 'style.html';
include 'db.php';
$sql1 = "select * from rank ";
$result = mysqli_query($db, $sql1);
$sql = "select * from rank ORDER BY total ";
$result = mysqli_query($db, $sql);?>
<div class="rank">
<div class="title1">
<div class="title1__rank">排名</div>
<div class="title1__playerName">玩家</div>
<div class="title1__times">次數</div>
<div class="title1__time">時間</div>
</div>
<?php
$i = 1;
while ($row = mysqli_fetch_assoc($result)) {
echo '<div class="player">';
echo '<div class="player__rank">No.'.$i."</div>";
echo '<div class="player__name">'.$row['name']."</div>";
echo '<div class="player__times">'.$row['times']."</div>";
echo '<div class="player__time">'.$row['min'].":".$row['sec']."</div>";
echo '</div>';
$i++;
}
header("Refresh:5;url=index.php")
?>
同樣會在5秒後自動跳轉到一開始輸入玩家名稱的地方,並將儲存剛才所猜的數字與線索的table以及所作的筆記清空。