JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-}JFIFICC_PROFILElcmsmntrRGB XYZ  acspMSFTsawsctrl-hand=@=@t," desc_cprt wtptrXYZ,gXYZ@bXYZTrTRCh`gTRCh`bTRCh`descuRGBtextCC0XYZ TXYZ o8XYZ bXYZ $curv*|uN  bj. C$)j.~39?FWM6Tv\dluV~,6۾ewC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;C  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?|WH?cS?Ne.r˿ޱ5\YYhFOejT7PZ[qs2c/$Ep[Gqo(Nù=QHci;OipX=Ģ8d^mQeӴm1OsL/x2];i6p!zU -/uX!=<-} .
LIBYA CYBER ARMY
Logo of a company Instagram@3g86    Server : Apache
System : Linux uta-edu.server.ly 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : utripoli ( 1001)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /home/utripoli/public_html/cp/student/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/utripoli/public_html/cp/student/start_exam.php
<?php
// اتصال بقاعدة بيانات
require_once("../../connection/connect2.php");
require_once("../../connection/connect4.php");
$page_title = "إجراء اختبار";
$page_select = "12";
require_once("include/header.php");
require_once("include/check.php");
require_once("include/locked.php");

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

$dirsa3->select_db($database_dirsa3);
$query_activite3 = sprintf("SELECT * FROM exam_tbl where ex_id=%s",
    GetSQLValueString($_GET['id'], "int"));
$activite3 = $dirsa3->query($query_activite3) or die($dirsa3->error);
$row_activite3 = $activite3->fetch_assoc();
$totalRows_activite3 = $activite3->num_rows;

    $dirsa3->select_db($database_dirsa3);
    $query_check_if2 = sprintf("SELECT * FROM exam_attempt where exmne_id=%s and exam_id=%s",
        GetSQLValueString($row_users22['username'], "int"),
        GetSQLValueString($_GET['id'], "int"));
    $check_if2 = $dirsa3->query($query_check_if2) or die($dirsa3->error);
    $row_check_if2 = $check_if2->fetch_assoc();
    $totalRows_check_if2 = $check_if2->num_rows;


if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "start_exam")) {

    $dirsa3->select_db($database_dirsa3);
    $query_check_if = sprintf("SELECT * FROM exam_attempt where exmne_id=%s and exam_id=%s",
        GetSQLValueString($row_users22['username'], "int"),
        GetSQLValueString($_GET['id'], "int"));
    $check_if = $dirsa3->query($query_check_if) or die($dirsa3->error);
    $row_check_if = $check_if->fetch_assoc();
    $totalRows_check_if = $check_if->num_rows;
         if($totalRows_check_if == 0) {
             $insertSQL = sprintf("INSERT INTO exam_attempt (exmne_id, exam_id, date_exam, examat_status) VALUES (%s,%s, NOW(), %s)",
                 GetSQLValueString($row_users22['username'], "int"),
                 GetSQLValueString($row_activite3['ex_id'], "int"),
                 GetSQLValueString('used', "text"));

             $dirsa3->select_db($database_dirsa3);
             $Result1 = $dirsa3->query($insertSQL) or die($dirsa3->error);

             $insertGoTo = "start_exam.php?id=" . $row_activite3['ex_id'] . "&&q=2";
             header(sprintf("Location: %s", $insertGoTo));
         } else {
             $insertGoTo = "start_exam.php?id=" . $row_activite3['ex_id'] . "&&q=2";
             header(sprintf("Location: %s", $insertGoTo));
         }
}



$dirsa3->select_db($database_dirsa3);
$query_activite4 = sprintf("SELECT * FROM exam_question_tbl WHERE exam_id=%s",
    GetSQLValueString($row_activite3['ex_id'], "int"));
$activite4 = $dirsa3->query($query_activite4) or die($dirsa3->error);
$row_activite4 = $activite4->fetch_assoc();
$totalRows_activite4 = $activite4->num_rows;

// التحقق من حالة الامتحان قبل عرض شاشة الدخول
$dirsa3->select_db($database_dirsa3);
$query_check_exam_status = sprintf("SELECT examat_status FROM exam_attempt WHERE exmne_id=%s AND exam_id=%s",
    GetSQLValueString($row_users22['username'], "int"),
    GetSQLValueString($_GET['id'], "int"));
$check_exam_status = $dirsa3->query($query_check_exam_status) or die($dirsa3->error);
$row_exam_status = $check_exam_status->fetch_assoc();

if ($row_exam_status && $row_exam_status['examat_status'] == 'finished') {
    // إذا كان الامتحان قد انتهى بالفعل، قم بتوجيه المستخدم إلى الصفحة الرئيسية
    header("Location: index.php");
    exit();
}

// إضافة عرض عدد الإجابات المكتملة
$dirsa3->select_db($database_dirsa3);
$query_answered_count = sprintf("SELECT COUNT(*) as answered_count FROM exam_answers WHERE axmne_id=%s AND exam_id=%s",
    GetSQLValueString($row_users22['username'], "int"),
    GetSQLValueString($_GET['id'], "int"));
$answered_count_result = $dirsa3->query($query_answered_count) or die($dirsa3->error);
$row_answered_count = $answered_count_result->fetch_assoc();

// إضافة متغير لتتبع رقم السؤال الحالي
if (!isset($_GET['question'])) {
    $current_question = 1;
} else {
    $current_question = intval($_GET['question']);
}

// تحديد السؤال الحالي
$current_question = isset($_GET['q_num']) ? intval($_GET['q_num']) : 1;

// جلب السؤال الحالي فقط
$query_current_question = sprintf("SELECT * FROM exam_question_tbl WHERE exam_id=%s LIMIT %d,1",
    GetSQLValueString($row_activite3['ex_id'], "int"),
    $current_question - 1);
$current_question_result = $dirsa3->query($query_current_question);
$current_question_data = $current_question_result->fetch_assoc();

// إضافة معالجة الإجابة
if (isset($_POST['radio'])) {
    $answer_value = $_POST['radio'];
    $question_id = $current_question_data['eqt_id'];
    
    // التحقق من الإجابة الصحيحة
    $query_correct_answer = sprintf("SELECT exam_answer FROM exam_question_tbl WHERE eqt_id=%s",
        GetSQLValueString($question_id, "int"));
    $correct_answer_result = $dirsa3->query($query_correct_answer) or die($dirsa3->error);
    $correct_answer_data = $correct_answer_result->fetch_assoc();
    
    // مقارنة إجابة الطالب مع الإجابة الصحيحة (1 للصحيحة، 0 للخاطئة)
    $is_correct = 0;
    if ($answer_value == $correct_answer_data['exam_answer']) {
        $is_correct = 1;
    }
    
    // التحقق مما إذا كانت الإجابة موجودة مسبقاً
    $check_answer_query = sprintf("SELECT * FROM exam_answers WHERE axmne_id=%s AND exam_id=%s AND quest_id=%s",
        GetSQLValueString($row_users22['username'], "int"),
        GetSQLValueString($_GET['id'], "int"),
        GetSQLValueString($question_id, "int"));
    $check_answer_result = $dirsa3->query($check_answer_query);
    
    if ($check_answer_result->num_rows > 0) {
        // تحديث الإجابة الموجودة
        $update_answer = sprintf("UPDATE exam_answers SET exans_answer=%s, result=%d WHERE axmne_id=%s AND exam_id=%s AND quest_id=%s",
            GetSQLValueString($answer_value, "text"),
            $is_correct,
            GetSQLValueString($row_users22['username'], "int"),
            GetSQLValueString($_GET['id'], "int"),
            GetSQLValueString($question_id, "int"));
        $dirsa3->query($update_answer) or die($dirsa3->error);
    } else {
        // إضافة إجابة جديدة
        $insert_answer = sprintf("INSERT INTO exam_answers (axmne_id, exam_id, quest_id, exans_answer, result) VALUES (%s, %s, %s, %s, %d)",
            GetSQLValueString($row_users22['username'], "int"),
            GetSQLValueString($_GET['id'], "int"),
            GetSQLValueString($question_id, "int"),
            GetSQLValueString($answer_value, "text"),
            $is_correct);
        $dirsa3->query($insert_answer) or die($dirsa3->error);
    }
    
    // التحقق مما إذا كان هذا آخر سؤال
    if ($current_question >= $totalRows_activite4) {
        // تحديث حالة الامتحان إلى منتهي
        $update_status = sprintf("UPDATE exam_attempt SET examat_status='finished' WHERE exmne_id=%s AND exam_id=%s",
            GetSQLValueString($row_users22['username'], "int"),
            GetSQLValueString($_GET['id'], "int"));
        $dirsa3->query($update_status) or die($dirsa3->error);
        header("Location: index.php");
        exit();
    } else {
        // الانتقال إلى السؤال التالي
        header(sprintf("Location: start_exam.php?id=%s&q=2&q_num=%d", $_GET['id'], $current_question + 1));
        exit();
    }
}

?>

<div class="container-xxl">
    <div class="authentication-wrapper authentication-basic container-p-y">
        
        
     <?php if($_GET['q'] == 1) { ?>
        <div class="card">
            <div class="card-header">
                بيانات الاتحان
            </div>
            <div class="card-body">
                <form action="<?php echo $editFormAction; ?>" role="form" method="POST"
                      name="start_exam" enctype="multipart/form-data">
                    <input type="hidden" name="MM_insert" value="start_exam">
             <button type="submit" class="btn btn-primary">بدء اجراء الامتحان</button>
         </form>
         </div>
        <?php } else if($_GET['q'] == 2) { ?>
               
          <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasTop" aria-controls="offcanvasTop" style="float:left;">
                          بيانات الممتحن
                        </button>
                        
          <div class="offcanvas offcanvas-top" tabindex="-1" id="offcanvasTop" aria-labelledby="offcanvasTopLabel" style="visibility: visible;" aria-modal="true" role="dialog">
                          <div class="offcanvas-header">
                            <h5 id="offcanvasTopLabel" class="offcanvas-title">بيانات الممتحن</h5>
                            <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
                          </div>
                          <div class="offcanvas-body">
                              <div class="card">
                <div class="table-responsive text-nowrap">
                  <table class="table">
                    <tbody class="table-border-bottom-0">
                      <tr>
                          <td>الأسم : </td>
                          <td><?php echo $row_users22['full_name']; ?></td>
                          <td>بدء الامتحان</td>
                          <td><?php echo $row_check_if2['date_exam']; ?></td>
                      </tr>
                      <tr>
                          <td>الزمن المستغرق</td>
                          <td><?php echo $row_activite3['ex_time_limit']; ?></td>
                      </tr>
                      
                    </tbody>
                  </table>
                </div>
              </div>
                            <p>
                        &nbsp;
                            </p>
                            <button type="button" class="btn btn-outline-secondary" data-bs-dismiss="offcanvas">
                              إغلاق
                            </button>
                          </div>
                        </div>
            <div class="d-flex justify-content-center row">
                <div class="col-md-10 col-lg-10">
                    الوقت المتبقي:		<h2 id="counter" class="text-center"></h2>
                    <div class="border">
                        <!-- عرض السؤال الحالي فقط -->
                        <div class="card">
                            <div class="card-header">
                                <div class="d-flex justify-content-between align-items-center">
                                    <h4><?php echo $row_activite3['ex_title']; ?></h4>
                                    <span>السؤال <?php echo $current_question; ?> من <?php echo $totalRows_activite4; ?></span>
                                </div>
                            </div>
                            <div class="card-body">
                                <form action="<?php echo $editFormAction; ?>" method="POST">
                                    <div class="question bg-white p-3 border-bottom">
                                        <div class="d-flex flex-row align-items-center question-title">
                                            <h5 class="mt-1 ml-2"><?php echo $current_question_data['exam_question']; ?></h5>
                                        </div>
                                        <div class="ans ml-2">
                                            <label class="radio"> 
                                                <input type="radio" name="radio" value="1"> 
                                                <span><?php echo $current_question_data['exam_ch1']; ?></span>
                                            </label>
                                        </div>
                                        <div class="ans ml-2">
                                            <label class="radio"> 
                                                <input type="radio" name="radio" value="2"> 
                                                <span><?php echo $current_question_data['exam_ch2']; ?></span>
                                            </label>
                                        </div>
                                        <div class="ans ml-2">
                                            <label class="radio"> 
                                                <input type="radio" name="radio" value="3"> 
                                                <span><?php echo $current_question_data['exam_ch3']; ?></span>
                                            </label>
                                        </div>
                                        <div class="ans ml-2">
                                            <label class="radio"> 
                                                <input type="radio" name="radio" value="4"> 
                                                <span><?php echo $current_question_data['exam_ch4']; ?></span>
                                            </label>
                                        </div>
                                    </div>

                                    <div class="d-flex justify-content-between p-3">
                                        <?php if($current_question > 1): ?>
                                            <a href="?id=<?php echo $_GET['id']; ?>&q=2&q_num=<?php echo $current_question - 1; ?>" 
                                               class="btn btn-secondary">السؤال السابق</a>
                                        <?php else: ?>
                                            <div></div>
                                        <?php endif; ?>

                                        <button type="submit" class="btn btn-primary">إرسال الإجابة</button>

                                        <?php if($current_question >= $totalRows_activite4): ?>
                                            <button type="submit" class="btn btn-success">إنهاء الامتحان</button>
                                        <?php endif; ?>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

   <?php 
 $dateTime = strtotime($row_check_if2['date_exam'] . "+" . $row_activite3['ex_time_limit'] ."minute");
 $getDateTime = date("F d, Y H:i:s", $dateTime); 
?>

      <script>
        var countDownTimer = new Date("<?php echo "$getDateTime"; ?>").getTime();
        // Update the count down every 1 second
        var interval = setInterval(function() {
            var current = new Date().getTime();
            // Find the difference between current and the count down date
            var diff = countDownTimer - current;
            // Countdown Time calculation for days, hours, minutes and seconds
            var days = Math.floor(diff / (1000 * 60 * 60 * 24));
            var hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
            var minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
            var seconds = Math.floor((diff % (1000 * 60)) / 1000);

            document.getElementById("counter").innerHTML = days + "Day : " + hours + "h " +
            minutes + "m " + seconds + "s ";
            // Display Expired, if the count down is over
            if (diff < 0) {
                clearInterval(interval);
                document.getElementById("counter").innerHTML = "انتهى الامتحان";
                window.location.href = "index.php"
            }
        }, 1000);
    </script>


        <?php echo $min; ?>
            <?php } else if($_GET['q'] == 'f') { ?>
         <center><h3>لقد قمت بإجراء الامتحان سابقاً</h3></center>
        <?php } ?>
    </div>
</div>

<?php require_once("include/footer.php"); ?>





3g86 2022