<?php require_once("includes/initialize.php");
if (!$session->is_logged_in()) {
    redirect_to("index.php");
}
echo $id = $session->user_id;
$biodata = Biodata::find_by_id($session->user_id);
//$mode= $user_data->mode;
//$user_data->std_process_id;
$user_data = Userdata::find_by_id($session->user_id);
$current_session = SESSIONCLASS::session_authenticate();

echo "Received ";
echo $biodata->surname;
echo $biodata->othernames;
$transact = Certificate::t_processing($id, $current_session->session);
$transaction = Certificate::authenticate($biodata->formno, $biodata->email);
if ($transaction->responsecode == 'Approved Successfully') {

    if ($user_data->std_process_id < 2) {
        $level = $user_data->std_process_id + 1;
        $update_process = Userdata::update($id, $level);
    }
    //echo $user_data->std_process_id;


    $session->message("{$transaction->responsecode}");


    redirect_to("http://eportal.oscotechesaoke.edu.ng/student_portal/dashboard.php?type=certificate");

} else {
    //echo $transaction->responsecode." Testing page";
//$session->message("'.{$transaction->responsecode}.'");
    //echo $transaction->responsecode." Testing page";
    $session->message("{$transaction->responsecode}");
    redirect_to("http://eportal.oscotechesaoke.edu.ng/student_portal/dashboard.php?type=certificate");

}

?>
