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: quizControl.php
Close
<?php include 'assets/php/validate.logged.php'; include 'assets/php/db_config.php'; // Fetch data from the table function fetchQuizes() { global $conn; $sql = "SELECT * from quizes"; // $sql = "SELECT * FROM candidate"; $result = $conn->query($sql); echo "<table> <thead> <tr> <th>ID</th> <th>Quiz Name</th> <th>Quiz description</th> <th>Duration in minutes</th> <th>Start date</th> <th>End date</th> <th>Quiz Status</th> <th>View Questions</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["quiz_name"] . "</td> <td>" . $row["description"] . "</td> <td>" . $row["duration"] . "</td> <td>" . $row["start_time"] . "</td> <td>" . $row["end_time"] . "</td> <td>" . $row["isCompleted"] . "</td> <td><a href='quizQuestions.php?quizId=" . $row['id'] . "'>View</a></td> <td><a href='editQuiz.php?quizId=" . $row['id'] . "'>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; } #quizForm{ margin: 40px; } </style> <script> function deleteQuiz(quizId) { // Ask for confirmation before deletion if (confirm("Are you sure you want to delete this quiz?")) { // Send the AJAX request using jQuery $.ajax({ url: 'adminProcess/updateQuiz.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("Quiz 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() { $('#quizForm').on('submit', function(e) { e.preventDefault(); // Prevent the default form submission var formData = $(this).serialize(); // Serialize the form data $.ajax({ url: 'adminProcess/updateQuiz.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'); // Handle any post-registration actions, like redirecting or displaying a message window.location.href = "quizControl.php"; // You can customize the redirect } else { alert('Failed to update the quiz. ' + 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 showQuizForm() { var formContainer = document.getElementById('quizFormContainer'); 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='index.php'" style="border-radius: 10px;">Back</button> <h1>Quizes</h1> <? fetchQuizes(); ?> <button onclick="showQuizForm()" style="border-radius: 10px;">Add Quiz</button> <div id="quizFormContainer" style="display:none;"> <form id="quizForm"> <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"> <div class="col-md-6 mb-3"> <label for="quizName" class="form-label">Quiz Name</label> <input type="text" class="form-control" name="quizName" required> </div> <div class="col-md-6 mb-3"> <label for="quizDuration" class="form-label">Quiz Duration in minutes</label> <input type="number" class="form-control" name="quizDuration" required> </div> </div> <div class="row"> <div class="col-md-6 mb-3"> <label for="startTime" class="form-label">Start Date and Time</label> <input type="datetime-local" class="form-control" name="startTime" required> </div> <div class="col-md-6 mb-3"> <label for="endTime" class="form-label">End Date and Time</label> <input type="datetime-local" class="form-control" name="endTime" required> </div> </div> <div class="mb-3"> <label for="quizDescription" class="form-label">Quiz Description</label> <textarea class="form-control" name="quizDescription" required></textarea> </div> <button type="submit" onclick="submitForm()" class="btn btn-success">Create Quiz</button> </form> </div> </body> </html>