<?php require_once("includes/initialize.php");
if (!$session->is_logged_in()) {
    redirect_to("index.php");
}
$id = $session->user_id;
$user_data = Userdata::find_by_id($session->user_id);
$biodata = Biodata::find_by_id($user_data->formno, $user_data->email);
//$mode= $user_data->mode;
//$user_data->std_process_id;
$dp = DEPARTMENTCLASS::department_authenticate($biodata->courses);




$alldp = DEPARTMENTCLASS::find_all($dp->faculty);

$current_session = SESSIONCLASS::session_authenticate();


//$total_sc_fees=0;
foreach ($alldp as $aldp) {
    $faculty = $aldp->faculty;
}
$pay_cat = '';
if ($faculty == 'Engineering' or $faculty == 'Applied Sciences' or $faculty == 'Enviromental Studies') {
    $pay_cat = 'science';
} elseif ($faculty == 'Management Sciences') {
    $pay_cat = 'nonscience';
}
$level = $biodata->programme;
$level = $level . " " . "I";
$transact = Certificate::t_processing($id, $biodata->session);
$transaction = Certificate::authenticate($biodata->formno, $biodata->email);
if ($transaction->responsecode == 'Approved Successful') {

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


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


    redirect_to("http://localhost/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://localhost/student_portal/dashboard.php?type=certificate");

}

?>
