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.222.118.236
<?php
function loadDegree($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query1 = "select * from entdeg";
$result1 = $aobj_context->mobj_db->GetAll($query1);
// var_dump($result1);
if($result1)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result1,0,"success");
}
else
{
$arr = "Some Failure as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
}
}
function createUser($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$json = new Services_JSON();
$usrname = stripslashes($aobj_context->mobj_data["usrname"]);
$password = stripslashes($aobj_context->mobj_data["password"]);
$mob = stripslashes($aobj_context->mobj_data["mob"]);
$name = stripslashes($aobj_context->mobj_data["name"]);
$checkedValue = stripslashes($aobj_context->mobj_data["checkedValue"]);
$screen = stripslashes($aobj_context->mobj_data["screen"]);
if($screen == 'add')
{
$query = "INSERT INTO `masuser` (`fusername`, `fmobileno`, `fname`, `fpasswd`, `fdegree`, `fusertype`, `fdeggrp`)
VALUES
('{$usrname}', '{$mob}', '{$name}', '{$password}', '{$checkedValue}', 'usr','PG')";
$rst = $aobj_context->mobj_db->Execute($query);
}else if($screen == 'edit')
{
$query = "update masuser set fusername = '{$usrname}',
fname = '{$name}',
fdegree = '{$checkedValue}*',
fdeggrp = 'PG'
where
fmobileno = '{$mob}'";
$rst = $aobj_context->mobj_db->Execute($query);
}
if($rst)
{
$success_msg= "Updated Successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($success_msg,0,"success");
}
else
{
$error_msg = "Some Failure as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"error");
}
}
function loadusers($aobj_context) {
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query1 = "select fusername,ifnull(fmobileno,' - ') as mob, ifnull(fname,' - ') as name,
if(fusertype = 'adm','Admin','User') as user_type,
ifnull(fdegree,'') as fdegree,
ifnull(fdeggrp,'') as fdeggrp
from masuser where ifnull(fdeleted,'') <> 'T'
and ifnull(fmobileno,'') <> ''";
$result1 = $aobj_context->mobj_db->GetAll($query1);
if($result1)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result1,0,"success");
}
else
{
$arr = "Some Failure as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
}
}
function loadDegGrp($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query1 = "select distinct fdeggrp from degree where ifnull(fdeggrp,'') <> ''";
$result1 = $aobj_context->mobj_db->GetAll($query1);
if($result1)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result1,0,"success");
}
else
{
$arr = "Some Failure as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
}
}
function loadDegreeg($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query1 = "select * from entdeg";
$result1 = $aobj_context->mobj_db->GetAll($query1);
if($result1)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result1,0,"success");
}
else
{
$arr = "Some Failure as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
}
}
function loadDegree1($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query1 = "select distinct `FPROGCODE`, fdescpn from degree
group by FPROGCODE
order by fdegree";
$result1 = $aobj_context->mobj_db->GetAll($query1);
if($result1)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result1,0,"success");
}
else
{
$arr = "Some Failure as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
}
}
function deleteUser($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$mob = stripslashes($aobj_context->mobj_data["mob"]);
$query = "update masuser set fdeleted = 'T'
where
fmobileno = '{$mob}'";
$result1 = $aobj_context->mobj_db->Execute($query);
if($result1)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result1,0,"success");
}
else
{
$arr = "Some Failure as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
}
}
function logout($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$_SESSION = [];
session_unset();
session_destroy();
session_write_close();
setcookie(session_name(),'',0,'/');
session_regenerate_id(true);
if(!isset($_SESSION['USERNAME']))
{
$arr = "Logged out successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else
{
$arr = "Some Failure as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
}
}
|