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.221.114
<?php
function uploadpostnotification($aobj_context)
{
var_dump($_FILES['filepath']['name']);
}
function getPostnotificationDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = "SELECT fpostno, flabel, ffilepath, DATE_FORMAT(ffromdate,'%d/%m/%Y') AS ffromdate,
DATE_FORMAT(ftodate,'%d/%m/%Y') AS ftodate, forder FROM postnotfn
WHERE fpostno NOT IN (116, 117) AND IFNULL(fdeleted,'')= 'F' ORDER BY forder";
$lobj_get_post_details = $aobj_context->mobj_db->GetAll($query);
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_post_details);
// var_dump($query);
// var_dump($lobj_get_post_details);
}
function getPostnotificationEdit($aobj_context){
$postNotfno=trim($aobj_context->mobj_data["postno"]);
// $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query = "SELECT fpostno, flabel, ffilepath, DATE_FORMAT(ffromdate,'%d/%m/%Y') AS ffromdate,
DATE_FORMAT(ftodate,'%d/%m/%Y') AS ftodate, forder,fcolour
FROM postnotfn WHERE fpostno = $postNotfno";
$lobj_get_postno_details = $aobj_context->mobj_db->GetRow($query);
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_postno_details);
//var_dump($lobj_get_user_right);
}
function getPostnotificationDelete($aobj_context){
$postNotfno=trim($aobj_context->mobj_data["postno"]);
$query = "UPDATE postnotfn SET fdeleted = 'T' WHERE fpostno = $postNotfno";
$lobj_delete_postno_details = $aobj_context->mobj_db->Execute($query);
// var_dump($query);
// var_dump($lobj_get_postno_details);
if($lobj_delete_postno_details)
{
$msg = "Removed Successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($msg,0,"success");
return;
}else{
$msg = "Removing was Unsuccessfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($msg,0,"failure");
return;
}
}
function savepostnotification($aobj_context)
{
//return;
$postno = trim($aobj_context->mobj_data["postno"]);
$type = trim($aobj_context->mobj_data["type"]);
$label=trim($aobj_context->mobj_data["label_type"]);
$filepath=trim($aobj_context->mobj_data["filepath"]);
$hfilepath=trim($aobj_context->mobj_data["samefile"]);
$fromdate=trim($aobj_context->mobj_data["post_date_from"]);
$todate=trim($aobj_context->mobj_data["post_date_to"]);
$order=trim($aobj_context->mobj_data["order_no"]);
$colour=trim($aobj_context->mobj_data["colour"]);
$new=trim($aobj_context->mobj_data["rate_value"]);
$path = $aobj_context->main_src."/notifications/";
if($type == 'add')
{
if(!file_exists($path))
{
mkdir($path);
}
$target_path = $path;
$target_path = $target_path . basename( $_FILES['filepath']['name']);
if(move_uploaded_file($_FILES['filepath']['tmp_name'], $target_path))
{
$filepath="notifications/".$_FILES['filepath']['name'];
$query = "insert into postnotfn(flabel, ffilepath, ffromdate, ftodate, forder, fcolour, fnew, fcreatedate)
values ('{$label}','{$filepath}',date_format(STR_TO_DATE('{$fromdate}','%d/%m/%Y'),'%Y-%m-%d'),
date_format(STR_TO_DATE('{$todate}','%d/%m/%Y'),'%Y-%m-%d'),'{$order}', '{$colour}', '{$new}',now())";
// var_dump($query);
$up_obj = $aobj_context->mobj_db->Execute($query);
if($up_obj)
{
$arr = "Updated Successfuly";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
else
{
$arr = "Updation Failed";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failed");
return;
}
}
}else{
if($hfilepath == 'T'){
$query = "UPDATE postnotfn SET flabel= '{$label}', ffromdate = date_format(STR_TO_DATE('{$fromdate}','%d/%m/%Y'),'%Y-%m-%d'),
ftodate = date_format(STR_TO_DATE('{$todate}','%d/%m/%Y'),'%Y-%m-%d'), forder = '{$order}', fcolour = '{$colour}', fnew = '{$new}'
WHERE fpostno = $postno" ;
$up_obj = $aobj_context->mobj_db->Execute($query);
if($up_obj)
{
$arr = "Updated Successfuly";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
else
{
$arr = "Updation Failed";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failed");
return;
}
}else
{
if(!file_exists($path))
{
mkdir($path);
}
$target_path = $path;
$target_path = $target_path . basename( $_FILES['filepath']['name']);
if(move_uploaded_file($_FILES['filepath']['tmp_name'], $target_path))
{
$filepath="notifications/".$_FILES['filepath']['name'];
$query = "UPDATE postnotfn SET flabel= '{$label}', ffromdate = date_format(STR_TO_DATE('{$fromdate}','%d/%m/%Y'),'%Y-%m-%d'),
ftodate = date_format(STR_TO_DATE('{$todate}','%d/%m/%Y'),'%Y-%m-%d'), ffilepath = '{$filepath}',
forder = '{$order}', fcolour = '{$colour}', fnew = '{$new}' WHERE fpostno = $postno" ;
// var_dump($query);
$up_obj = $aobj_context->mobj_db->Execute($query);
if($up_obj)
{
$arr = "Updated Successfuly";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
else
{
$arr = "(New file)Updation Failed";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failed");
return;
}
}
}
}
}
?>
|