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.137.219.221
<?php
function getqrylst($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$fregno = $aobj_context->mobj_data["fregno"];
// $fusername = $aobj_context->mobj_data["fusername"];
$qry = "select h.fgrvid, from logisys3_grv.grvhead h
where h.fregno='$fregno'";// and funivcode
$result= $aobj_context->mobj_db->GetAll($qry);
// var_dump($result);
if(!$result && gettype($result) == 'boolean')
{
$arr['msg'] = "Error while fetching Greviences";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
return;
}
if(count($result) >= 0){
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
return;
}
}
function submitquery($aobj_context)
{
$req = $aobj_context->req_body['data'];
// var_dump($req);
if (!array_key_exists('query', $req) || !array_key_exists('user', $req)) {
$arr['msg'] = 'Invalid Params';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
$query = $req['query'];
$user = $req["user"];
$docpath = $req["docpath"];
$aobj_context->mobj_db->setCharset('utf8mb4');
// $query['body'] = htmlentities($query['body']);
$query = "insert into logisys3_grv.grvhead(fgrvdate,fregno,fgrvfrom,fgrvemail,fgrvmobile,fgrvsub,
fgrvmsg,fgrvuser,fgrvmode,funivcode)
values(now(), '{$user['fuserid']}', '{$user['fname']}', '{$user['femail']}', '{$user['fmobileno']}',
'{$query['subject']}', '{$query['body']}', '{$user['fcurtype']}', 'EGOV', '{$user['fcuruniv']}') ";
// var_dump($query);
$results = $aobj_context->mobj_db->Execute($query);
// var_dump($results);
$last_inserted_id = $aobj_context->mobj_db->Insert_ID();
// var_dump($last_inserted_id);
if($results)
{
$arr['msg'] = $last_inserted_id;
if (preg_match('/^data:image\/(\w+);base64,/', $docpath, $type))
{
$docpath = substr($docpath, strpos($docpath, ',') + 1);
$type = strtolower($type[1]); // jpg, png, gif
$docpath = base64_decode($docpath);
if ($docpath === false)
{
}else
{
$dir = dirname(__DIR__, 1);
$folder = $dir . DIRECTORY_SEPARATOR . 'grvdocs';
if(!file_exists($folder))
{
mkdir($folder);
}
$file = $folder."/$last_inserted_id." . $type;
$res = file_put_contents($file, $data);
if($res)
{
$path = "grvdocs/$last_inserted_id." . $type;
$query = "update logisys3_grv.grvhead set ffilepath = '{$path}'
where fgrvid = '{$last_inserted_id}'";
$result = $aobj_context->mobj_db->Execute($query);
}
}
}
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
else
{
$arr['msg'] = 'Error while Submiting';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
?>
|