OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
quiz
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
06/17/2025 10:17:24 AM
rwxrwxr-x
📄
admin.php
2.97 KB
05/19/2025 10:07:16 AM
rw-r--r--
📁
adminProcess
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📁
assets
-
02/15/2025 11:20:33 AM
rwxr-xr-x
📁
backup
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📄
editData.php
16.75 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
editQuestion.php
8.03 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
editQuiz.php
8.3 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
footer.php
1.86 KB
05/19/2025 10:07:16 AM
rw-r--r--
📁
forms
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📄
go_back.php
2.96 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
index.php
12.68 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
login.php
4.34 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
nav_scripts.php
1.96 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
navbar.php
2.41 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
navbar_login.php
2.34 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
payment.php
12.06 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
quiz.php
20.67 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
quizControl.php
8.4 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
quizQuestions.php
8.85 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
quizSubmitPage.php
39 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
register.php
21.65 KB
05/19/2025 10:07:16 AM
rw-r--r--
📁
test
-
02/15/2025 11:20:34 AM
rwxr-xr-x
📁
test1
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📁
yt_subscription
-
05/19/2025 10:07:16 AM
rwxr-xr-x
Editing: quizQuestions.php
Close
<?php include 'assets/php/validate.logged.php'; include 'assets/php/db_config.php'; if (isset($_GET['quizId'])) { $quizId = $_GET['quizId']; } else { echo "Invalid Quiz Selected"; } // Fetch data from the table function fetchQuizes() { global $conn, $quizId; $sql = "SELECT * from questions where quiz_id=$quizId"; // $sql = "SELECT * FROM candidate"; $result = $conn->query($sql); echo "<table> <thead> <tr> <th>ID</th> <th>Question</th> <th>Option 1</th> <th>Option 2</th> <th>Option 3</th> <th>Option 4</th> <th>Answer</th> <th>Edit</th> <th>Delete</th> </tr> </thead> <tbody>"; // Check if data exists and output each row if ($result->num_rows > 0) { // Output data of each row $serial = 1; while ($row = $result->fetch_assoc()) { echo "<tr> <td>" . $serial . "</td> <td>" . $row["question"] . "</td> <td>" . $row["option1"] . "</td> <td>" . $row["option2"] . "</td> <td>" . $row["option3"] . "</td> <td>" . $row["option4"] . "</td> <td>" . $row["answer"] . "</td> <td><a href='editQuestion.php?queId=" . $row['id'] . "&quizId=" . $quizId . "'>Edit</a></td> <td><button onclick='deleteQuiz(" . $row['id'] . ")'>Delete</button></td> </tr>"; $serial++; } } else { echo "<tr><td colspan='4'>No records found</td></tr>"; } echo "</tbody> </table>"; // Close connection $conn->close(); } ?> <!DOCTYPE html> <html lang='en'> <head> <meta charset='UTF-8'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <title>Admin Dashboard</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="assets/css/styles.css"> <style> table { width: 100%; border-collapse: collapse; } table, th, td { border: 1px solid black; } th, td { padding: 10px; text-align: left; } #quesForm { margin: 40px; } </style> <script> function deleteQuiz(quizId) { // Ask for confirmation before deletion if (confirm("Are you sure you want to delete this Question?")) { // Send the AJAX request using jQuery $.ajax({ url: 'adminProcess/updateQuestion.php', // The PHP script that will handle the deletion type: 'POST', // Sending the request as POST data: { act: "delete", id: quizId }, // The data being sent to the server (quiz ID) success: function(response) { // Handle the response from the server if (response == "success") { alert("Question deleted successfully!"); location.reload(); // Reload the page to update the quiz list } else { alert("Error deleting quiz."); } }, error: function(xhr, status, error) { // Handle AJAX errors alert("An error occurred while deleting the quiz."); } }); } } function submitForm() { $('#quesForm').on('submit', function(e) { e.preventDefault(); // Prevent the default form submission var formData = $(this).serialize(); // Serialize the form data $.ajax({ url: 'adminProcess/updateQuestion.php', // PHP script to process the form data type: 'POST', data: formData, // Send the serialized form data success: function(response) { try { // Ensure the response is a JSON object var res = JSON.parse(response); // Check if the response contains a success flag if (res.success) { alert('Created Successfully'); location.reload(); // window.location.href = "quizQuestions.php"; } else { alert('Failed to update the Question. ' + res.message); } } catch (error) { alert('Error: Response is not in valid JSON format'); } }, error: function(xhr, status, error) { alert('An error occurred during form submission. Please try again.'); } }); }); } function showQuesForm() { var formContainer = document.getElementById('quesFormContainer'); formContainer.style.display = 'block'; // Show the form } </script> </head> <body> <header id="header" class="header d-flex align-items-center sticky-top"> <div class="container-fluid container-xl position-relative d-flex align-items-center"> <? include "navbar_login.php" ?> </div> </header> <button onclick="window.location.href='quizControl.php'" style="border-radius: 10px;">Back</button> <h1>Quiz-<?=$quizId?></h1> <? fetchQuizes(); ?> <button onclick="showQuesForm()" style="border-radius: 10px;">Add question</button> <div id="quesFormContainer" style="display:none;"> <form id="quesForm"> <h5>Quiz Details</h5> <div class="row" hidden> <div class="col-md-6 mb-3"> <input type="text" class="form-control" name="act" value="new" required> </div> </div> <div class="row" hidden> <div class="col-md-6 mb-3"> <input type="text" class="form-control" name="quizId" value="<?=$quizId?>" required> </div> </div> <div class="row"> <div class="mb-3"> <label for="ques" class="form-label">Question</label> <input type="text" class="form-control" name="ques" required> </div> </div> <div class="row"> <div class="col-md-6 mb-3"> <label for="option1" class="form-label">Option 1</label> <input type="text" class="form-control" name="option1" required> </div> <div class="col-md-6 mb-3"> <label for="option2" class="form-label">Option 2</label> <input type="text" class="form-control" name="option2" required> </div> </div> <div class="row"> <div class="col-md-6 mb-3"> <label for="option3" class="form-label">Option 3</label> <input type="text" class="form-control" name="option3" required> </div> <div class="col-md-6 mb-3"> <label for="option4" class="form-label">Option 4</label> <input type="text" class="form-control" name="option4" required> </div> </div> <div class="col-md-6 mb-3"> <label for="answer" class="form-label">Answer(Please enter exactly as one of the option)</label> <input type="text" class="form-control" name="answer" required> </div> <button type="submit" onclick="submitForm()" class="btn btn-success">Create Question</button> </form> </div> </body> </html>