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 : 3.145.35.234
<?php
function getStudentProfile($aobj_context)
{
$data_json = file_get_contents("php://input");
$data = json_decode($data_json,true);
if($_SERVER['PHP_AUTH_USER'] == 'revaapiuser' && $_SERVER['PHP_AUTH_PW'] == 'reva@124')
{
}else
{
$arry='Unauthorized User';
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,-1,"Failure");
return;
}
if(count($data) <=0)
{
$arry='Kindaly Pass Data';
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,-1,"Failure");
return;
}
$resrayy = [];
$error = 0;
$succes = 0;
foreach($data as $val)
{
$res = [];
$res['regno'] = $val['regno'];
$sem=["1"=>"A","2"=>"B","3"=>"C","4"=>"D","5"=>"E","6"=>"F","7"=>"G","8"=>"H","9"=>"I","10"=>"J"];
if($val['rtype'] == '')
{
$res['status'] = "F";
$res['msg'] = "Request Type be Empty";
$error++;
}
else if($val['rtype'] == 'I')
{
if($val['degcode'] == '')
{
$res['status'] = "F";
$res['msg'] = "Degree Code Cant be Empty";
$error++;
}else if($val['collcode'] == '')
{
$res['status'] = "F";
$res['msg'] = "College Code Cant be Empty";
$error++;
}else if($val['regno'] == '')
{
$res['status'] = "F";
$res['msg'] = "Register No. Cant be Empty";
$error++;
}
else
{
$query = "select fdegree from degree where fedegcode = '{$val['degcode']}' and fexamno = 'A'";
$res1 = $aobj_context->mobj_db->getRow($query);
$fdegree = $res1['fdegree'];
if($res1)
{
$query = "select fcollcode from college where fecollcode = '{$val['collcode']}'";
$res2 = $aobj_context->mobj_db->getRow($query);
$collcode = $res2['fcollcode'];
if($res2)
{
$semvalue = $sem[$val['sem']];
$query = "INSERT INTO estudent (fregno,fdegree,fcollcode, fdob, fname, ffatname, ffmotname, fgender, fcaste, fmobileno, femail,
fdegcode, fdegname, fecollcode, fcollname, fsem, fnamechange, fdegchanmge, fcollchange, frtype, fayear,
fadmtype, fcreateddate,fephotopath)
VALUES ('{$val['regno']}','{$fdegree}','{$collcode}',date_format(str_to_date('{$val['dob']}','%d/%m/%Y'),'%Y-%m-%d'),
'{$val['name']}','{$val['fatname']}',
'{$val['motname']}','{$val['gender']}',
'{$val['caste']}','{$val['mob']}','{$val['email']}',
'{$val['degcode']}','{$val['degname']}',
'{$val['collcode']}','{$val['collname']}',
'{$semvalue}','{$val['namechange']}',
'{$val['degchanmge']}','{$val['collchange']}',
'{$val['rtype']}','{$val['ayear']}',
'{$val['admtype']}',now(),'{$val['StudentImage']}')";
$result = $aobj_context->mobj_db->Execute($query);
$query = "insert into student(fregno, fdob, fname, ffatname, fmotname, fgender, fcaste, fmobileno, femail,
fdegree, fcollcode, FEXAMNO, fnamechange, fdegchanmge, fcollchange, fstype,
fayear, fcreateddate,fephotopath)
select fregno, fdob, fname, ffatname, ffmotname, fgender, fcaste, fmobileno, femail,
fdegree, fcollcode, fsem, fnamechange, fdegchanmge, fcollchange, 'E',
fayear, fcreateddate,fephotopath from estudent where fregno = '{$val['regno']}'";
$result1 = $aobj_context->mobj_db->Execute($query);
if($result && $result1)
{
$res['status'] = "T";
$res['msg'] = "Inserted Successfully";
$succes++;
}else
{
$res['status'] = "F";
$res['msg'] = "Duplicate Register No.";
$error++;
}
}else
{
$res['status'] = "F";
$res['msg'] = "College Master Not Mached";
$error++;
}
}else {
$res['status'] = "F";
$res['msg'] = "Degree Master Not Mached";
$error++;
}
}
}else if($val['rtype'] == 'U')
{
$query = "select fdegree from degree where fedegcode = '{$val['degcode']}' and fexamno = 'A'";
$res1 = $aobj_context->mobj_db->getRow($query);
$fdegree = $res1['fdegree'];
if($res1)
{
$qyerty = "select fregno, fdob, fname, ffatname, ffmotname, fgender, fcaste, fmobileno, femail, fdegcode, fdegname, fcollcode, fcollname, fsem, fnamechange, fdegchanmge, fcollchange, frtype, fayear, fadmtype, now(),fephotopath from estudent where fregno = '{$val['regno']}'";
$res9 = $aobj_context->mobj_db->getRow($qyerty);
if($res9)
{
$query = "select fcollcode from college where fecollcode = '{$val['collcode']}'";
$res2 = $aobj_context->mobj_db->getRow($query);
$collcode = $res1['fcollcode'];
if($res2)
{
$query = "INSERT INTO estudchange (fregno, fdob, fname, ffatname, ffmotname, fgender, fcaste, fmobileno, femail, fdegcode, fdegname, fcollcode, fcollname, fsem, fnamechange, fdegchanmge, fcollchange, frtype, fayear, fadmtype, fcreateddate,fephotopath)
select fregno, fdob, fname, ffatname, ffmotname, fgender, fcaste, fmobileno, femail, fdegcode, fdegname, fcollcode, fcollname, fsem, fnamechange, fdegchanmge, fcollchange, frtype, fayear, fadmtype, now(),fephotopath from estudent where fregno = '{$val['regno']}'";
$result1 = $aobj_context->mobj_db->Execute($query);
$query = "update estudent set fname = '{$val['name']}',
fdegcode = '{$val['degcode']}',
fdegname = '{$val['degname']}',
fecollcode = '{$val['collcode']}',
fcollcode = '{$collcode}',
fcollname = '{$val['collname']}',
fdegchanmge = '{$val['degchanmge']}',
fnamechange = '{$val['namechange']}',
fcollchange = '{$val['collchange']}',
frtype = '{$val['rtype']}',
fupdateddate = now(),
fephotopath = '{$val['StudentImage']}'
where fregno = '{$val['regno']}'";
$result = $aobj_context->mobj_db->Execute($query);
$query = "update student set fname = '{$val['name']}',
fdegree = '{$fdegree}',
fcollcode = '{$collcode}',
fdegchanmge = '{$val['degchanmge']}',
fnamechange = '{$val['namechange']}',
fcollchange = '{$val['collchange']}',
fupdateddate = now(),
fephotopath = '{$val['StudentImage']}'
where fregno = '{$val['regno']}'";
$result1 = $aobj_context->mobj_db->Execute($query);
if($result && $result1)
{
$res['status'] = "T";
$res['msg'] = "Updated Successfully";
$succes++;
}else
{
$res['status'] = "F";
$res['msg'] = "Invalid Register No.";
$error++;
}
}else
{
$res['status'] = "F";
$res['msg'] = "College Master Not Mached";
$error++;
}
}else
{
$res['status'] = "F";
$res['msg'] = "Degree Master Not Mached";
$error++;
}
}else
{
$res['status'] = "F";
$res['msg'] = "Invaid Register No.";
$error++;
}
}
array_push($resrayy,$res);
}
$msg = "success";
if($succes >'0' && $error == '0')
{
$msg = "success";
}else if($error>'0' && $succes == '0')
{
$msg = "Failure";
}else if($succes >'0' && $error>'0')
{
$msg = "Partial";
}
$arry['resdata'] = $resrayy;
echo $aobj_context->mobj_output->ToJSONEnvelope($arry,0,$msg);
return;
}
?>
|