feat: make a feature for leaderboard
This commit is contained in:
parent
67cab5d06e
commit
e1478cb88d
@ -24,6 +24,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/js/firstperson.js"></script>
|
||||
<script type="module" src="/js/firstperson.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,32 +1,4 @@
|
||||
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},
|
||||
]
|
||||
},
|
||||
];
|
||||
import { questions } from "./soal.js";
|
||||
|
||||
const questionElement = document.getElementById("question")
|
||||
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
|
||||
|
||||
use LDAP\Result;
|
||||
|
||||
session_start();
|
||||
require_once "config/db.php";
|
||||
|
||||
@ -17,6 +20,10 @@ if ($result_me && mysqli_num_rows($result_me)>0){
|
||||
$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);
|
||||
$leaderboard = [];
|
||||
@ -80,19 +87,15 @@ if($result){
|
||||
?>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<?php
|
||||
$peringkat = 1;
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><?php echo $peringkat; ?></td>
|
||||
<td><?php echo $nama; ?></td>
|
||||
<table >
|
||||
<tbody >
|
||||
<tr >
|
||||
<td style="color: gold; font-weight: bold; border: 5px solid #bbd000;;" ><?php echo $realrank; ?></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>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user