<?php require_once "sfdPageLoader.php";

$id=$Encryption->decode(strip_tags($_GET['id']));

if(!is_numeric($id))
{
    exit("error: id not valid");
}

$result=$DB->prepare("DELETE FROM {$DB->tablePrefix}class WHERE sfd_user_id='$SfdUserId' AND id='$id' ");
if($result)
{
    $Msg->success("کلاس حذف شد");
    // delete student
    $DB->prepare("DELETE FROM {$DB->tablePrefix}class_student WHERE sfd_user_id='$SfdUserId' AND class_id='$id' ");
    // delete exam class
    $DB->prepare("DELETE FROM `{$DB->tablePrefix}exam_class` WHERE sfd_user_id='$SfdUserId' AND class_id='$id' ");
}

header("location:classForm.php");
exit;