feat: make a feature for leaderboard
This commit is contained in:
parent
67cab5d06e
commit
e1478cb88d
@ -24,6 +24,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/js/firstperson.js"></script>
|
<script type="module" src="/js/firstperson.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -1,32 +1,4 @@
|
|||||||
const questions = [
|
import { questions } from "./soal.js";
|
||||||
{
|
|
||||||
question: "what is Python ?",
|
|
||||||
answers: [
|
|
||||||
{text: "Programming Lang", correct: true},
|
|
||||||
{text: "Animal", correct: false},
|
|
||||||
{text: "Danger", correct: false},
|
|
||||||
{text: "All Answer Correct", correct: false},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
question: "Data type at python ?",
|
|
||||||
answers: [
|
|
||||||
{text: "Docx", correct: false},
|
|
||||||
{text: "CSV", correct: false},
|
|
||||||
{text: "String", correct: true},
|
|
||||||
{text: "SQL", correct: false},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
question: "Index at python start from ?",
|
|
||||||
answers: [
|
|
||||||
{text: "1", correct: false},
|
|
||||||
{text: "-1", correct: false},
|
|
||||||
{text: "10", correct: false},
|
|
||||||
{text: "0", correct: true},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const questionElement = document.getElementById("question")
|
const questionElement = document.getElementById("question")
|
||||||
const answerBtn = document.getElementById("btn-answer")
|
const answerBtn = document.getElementById("btn-answer")
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
export const questions = [
|
||||||
|
{
|
||||||
|
question: "what is Python ?",
|
||||||
|
answers: [
|
||||||
|
{text: "Programming Lang", correct: true},
|
||||||
|
{text: "Animal", correct: false},
|
||||||
|
{text: "Danger", correct: false},
|
||||||
|
{text: "All Answer Correct", correct: false},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Data type at python ?",
|
||||||
|
answers: [
|
||||||
|
{text: "Docx", correct: false},
|
||||||
|
{text: "CSV", correct: false},
|
||||||
|
{text: "String", correct: true},
|
||||||
|
{text: "SQL", correct: false},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
question: "Index at python start from ?",
|
||||||
|
answers: [
|
||||||
|
{text: "1", correct: false},
|
||||||
|
{text: "-1", correct: false},
|
||||||
|
{text: "10", correct: false},
|
||||||
|
{text: "0", correct: true},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
];
|
||||||
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use LDAP\Result;
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
require_once "config/db.php";
|
require_once "config/db.php";
|
||||||
|
|
||||||
@ -17,6 +20,10 @@ if ($result_me && mysqli_num_rows($result_me)>0){
|
|||||||
$score = $row['score'];
|
$score = $row['score'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$queryrank = "SELECT COUNT(*) as ranking FROM users WHERE score > $score";
|
||||||
|
$resultrank = mysqli_query($db, $queryrank);
|
||||||
|
$rowrank = mysqli_fetch_assoc($resultrank);
|
||||||
|
$realrank = $rowrank['ranking']+1;
|
||||||
|
|
||||||
$result = mysqli_query($db, $sql);
|
$result = mysqli_query($db, $sql);
|
||||||
$leaderboard = [];
|
$leaderboard = [];
|
||||||
@ -80,19 +87,15 @@ if($result){
|
|||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
|
||||||
$peringkat = 1;
|
|
||||||
|
|
||||||
?>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<table>
|
<table >
|
||||||
<tbody>
|
<tbody >
|
||||||
<tr>
|
<tr >
|
||||||
<td><?php echo $peringkat; ?></td>
|
<td style="color: gold; font-weight: bold; border: 5px solid #bbd000;;" ><?php echo $realrank; ?></td>
|
||||||
<td><?php echo $nama; ?></td>
|
<td style="color: gold; font-weight: bold; border: 5px solid #bbd000;;"><?php echo $nama; ?></td>
|
||||||
|
|
||||||
<td><?php echo $pemain['score']; ?> PTS</td>
|
<td style="color: gold; font-weight: bold; border: 5px solid #bbd000;;"><?php echo $score; ?> PTS</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user