📁 File Manager
🏠 /
/
home
/
u857492117
/
domains
/
mangaldaicollege.org
/
public_html
/
dk1
/
admin
Dosya Düzenle: delete_quiz.php
<?php session_start(); include("../config.php"); // Redirect if admin not logged in if(!isset($_SESSION['admin_id'])){ header("Location: admin_login.php"); exit; } // Check if quiz_id is provided if(!isset($_GET['quiz_id'])){ die("Quiz ID not provided."); } $quiz_id = intval($_GET['quiz_id']); // Check if quiz exists $quiz_res = mysqli_query($conn, "SELECT * FROM quizzes WHERE quiz_id='$quiz_id'"); if(mysqli_num_rows($quiz_res) == 0){ die("Quiz not found."); } // Delete quiz (questions and attempts will cascade if foreign keys are set) $delete_res = mysqli_query($conn, "DELETE FROM quizzes WHERE quiz_id='$quiz_id'"); if($delete_res){ $_SESSION['success_msg'] = "Quiz deleted successfully!"; header("Location: index.php"); exit; } else { $_SESSION['error_msg'] = "Error deleting quiz: ".mysqli_error($conn); header("Location: index.php"); exit; } ?>
💾 Kaydet
İptal