0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.218.231.116


Current Path : /proc/thread-self/root/var/www/html/pgadm2020/pgetadm/
Upload File :
Current File : //proc/thread-self/root/var/www/html/pgadm2020/pgetadm/add-course.php

<?php

function getAddCourseStatus($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    
    session_start();

    // $res = true;
	// if($res) {
	// 	$arr['msg'] = 'Last date is over';
	// 	echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
	// 	return;
	//  } 

    $mobileno = $_SESSION['MOBILE'];
    $query1 = "select fname, fmobileno, fappno, ifnull(fpaystatus,'') as fpaystatus,
    ifnull(ffinsub,'F') as ffinsub, ifnull(fqdegree,'') as fqdegree, b.fdescpn,  
    ifnull(fqcombcode,'') as fqcombcode, c.fdescpn as fcombdesc, ifnull(fcategory,'') as fcategory 
    from entstudadm a inner join entprevdeg b on a.fqdegree = b.fdegree 
    inner join entprevcomb c on a.fqdegree = c.fdegree and a.fqcombcode = c.fcombcode
    where fmobileno = '{$mobileno}'";

    $results1 = $aobj_context->mobj_db->GetRow($query1);	
    // var_dump(count($results1));
    if(count($results1) == 0) {
        $arr['msg'] = "Apply for addtional course is not available";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
        return;
    }
    $fappno = $results1['fappno'];
    $fpaystatus = $results1['fpaystatus'];
    $ffinsub = $results1['ffinsub'];
    $degcode = $results1['fqdegree'];
    $combcode = $results1['fqcombcode'];

    if($ffinsub == 'F' || $fpaystatus != 'success') {
        $arr['msg'] = "Apply for addtional course is not available";
        $arr['data'] = $results1;
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
        return;
    }

    $query = "select fsubcode from entprevmarks where fappno = '{$fappno}' and fcombcode = 'LAN'";
    $results = $aobj_context->mobj_db->GetAll($query);

    $lan1 = $results[0]['fsubcode'];
    $lan2 = $results[1]['fsubcode'];

    $query = "select distinct d.fdegree,d.fdescpn,if(ifnull(sd.fdegree,'')='','','checked') as sddeg 
    from entdeg d inner join entprevcomb c on instr(feligdeg,concat(d.fdegree,'*')) > 0
    left join entoptdeg sd on d.fdegree = sd.fdegree and fappno = '{$fappno}'
    and ifnull(sd.fdeleted,'') <> 'T'
    where instr(feligdeg,concat(d.fdegree,'*')) >0
    and c.fdegree = '{$degcode}' and c.fcombcode = '{$combcode}'
    union
    select distinct d.fdegree,d.fdescpn,if(ifnull(sd.fdegree,'')='','','checked') as sddeg 
    from entdeg d inner join entprevcomb c on instr(feligdeg,concat(d.fdegree,'*')) > 0
    left join entoptdeg sd on d.fdegree = sd.fdegree and fappno = '8261004162'
    and ifnull(sd.fdeleted,'') <> 'T'
    where instr(feligdeg,concat(d.fdegree,'*')) >0
    and c.fcombcode = 'LAN' and c.fsubcode in ('{$lan1}', '{$lan2}')";
    // var_dump($query);
    $result = $aobj_context->mobj_db->GetAll($query);
    // var_dump($result1);
    
    if(count($result) > 0) {
        $arr['optdeg'] = $result;
        $arr['info'] = $results1;
	    echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	    return;
    }
    else {
        $arr['msg'] = "Eligible degree not defined for the given Combination code";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
        return;
    }
}

function applyForAddCourse($aobj_context) {

    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $degrees = $aobj_context->mobj_data["degrees"];
    $degrees = stripslashes($aobj_context->mobj_data["degrees"]);
	$degrees = json_decode($degrees, true);	
    $totalfee = $aobj_context->mobj_data["totalfee"];
    $gstudInfo = stripslashes($aobj_context->mobj_data["gstudInfo"]);
    $gstudInfo = json_decode($gstudInfo, true);	

    if($gstudInfo['fappno'] == "") {
        $arr['msg'] = "Zero Fee cannot make payment.";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
        return;
    }
    
    if($totalfee <= 0) {
        $arr['msg'] = "Zero Fee cannot make payment.";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
        return;
    }

    // var_dump($degrees,$totalfee,$gstudInfo);

    $insDegree = "";
    foreach($degrees as $deg){
        $insDegree .= $deg['optdeg'].'*';
    }
    // var_dump($insDegree);

    $query = "insert into entaddcourse (fappno, fdegree, ftotalfee)
    values( '{$gstudInfo['fappno']}', '{$insDegree}', '{$totalfee}')";
    $result = $aobj_context->mobj_db->Execute($query);

    if($result) {
        $res['faddappno'] = $aobj_context->mobj_db->insert_Id();
        echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
	    return;
    } else {
        $arr['msg'] = "Error while applying to addtional course.";
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"); 
        return;
    }
}

function addCourseGetPayDet($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $appno = $aobj_context->mobj_data["appno"];
    
    $query1 = "select a.faddappno, ifnull(fpaystatus,'') as fpaystatus, 
    b.fdegree, b.fdescpn, ftotalfee 
    from entaddcourse a, entdeg b where faddappno = '{$appno}'
    and instr(a.fdegree, b.fdegree)";
    // var_dump($query1);
    $results1 = $aobj_context->mobj_db->GetAll($query1);
    
    if($results1[0]['fpaystatus'] == 'success')
    {
      $data['msg'] = "Payment made for this application.";
      echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"Faiure"); 
      return;
    }
    else
    {
      $query = "select * from masbank where ifnull(fsuspend,'') <> 'T'";
      $results = $aobj_context->mobj_db->GetAll($query);	

      $data['masbank'] = $results;
      $data['appno'] = $results1[0]['faddappno'];
      $data['totalfee'] = $results1[0]['ftotalfee'];
      $data['fdegree'] = $results1;
      echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
      return;
    }
}