<?php
include("../db.php");
header('Content-Type: application/json');

    $id = $_POST['liveid'];
    $uid = $_POST['uid'];

    $status = 0;

    $getData = $db->getRow("select * from liveclass_meet where id='".$id."' ");

    $student = $db->getRow("select * from student where idno='$uid' ");

    if(count($getData)>1){

     $attAry = array(
         "student_id"   =>  $uid,
         "class"        => $getData['class'],
         "section"      => $student['section'],
         "chapter"      => $getData['chapter'],
         "topic"        => $getData['topic'],
         "teacher_id"   => $getData['teacher_id'],
         "session"      => $student['session'],
         "user_email"   => $student['email']
         );
         
         $flg = $db->insertAry("meet_attendance", $attAry);
         
         if($flg > 0 ){
             $status = 1;
         } else {
             $status = 0;
         }

    }
    else {
         $status= 0;
    }

    $array = array("status"=>$status);

    echo json_encode($array);
 
// $simple_string = json_encode($array);
// $ciphering = "AES-128-CTR"; 
// $iv_length = openssl_cipher_iv_length($ciphering); 
// $options = 0;
// $encryption_iv = '1234567891011121';
// $encryption_key = "GeeksforGeeks";
// $encryption = openssl_encrypt($simple_string, $ciphering,$encryption_key, $options, $encryption_iv); 

// echo $encryption;

?>