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.128.201.71
<?php
function saveCreateUser($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$mobile = $aobj_context->mobj_data['mobile'];
$name = $aobj_context->mobj_data['name'];
$gender = $aobj_context->mobj_data['gender'];
$dob = $aobj_context->mobj_data['dob'];
$email = $aobj_context->mobj_data['email'];
$data = $aobj_context->mobj_data['data'];
$teachercode = $aobj_context->mobj_data['teachcode'];
if($data === "*"){
$dataCond = NULL;
}else{
$dataCond = $data;
}
if($teachercode === "undefined"){
$query = "insert into masteach(FTEACHNAME, FGENDER, FDOB, FMOBILE, FEMAIL)
values('{$name}', '{$gender}', date_format(str_to_date('{$dob}', '%d/%m/%Y'), '%Y-%m-%d'),
'{$mobile}', '{$email}')";
$result = $aobj_context->pobj_db->Execute($query);
$slt = "select internal_code from masteach where FMOBILE='{$mobile}'";
$reslt = $aobj_context->pobj_db->GetRow($slt);
$teachcode = $reslt['internal_code'];
$ins = "update masteach set fteachcode='{$teachcode}'
where FMOBILE='{$mobile}' and internal_code='{$teachcode}'";
$resIns = $aobj_context->pobj_db->Execute($ins);
$insMas = "insert into tdvs_masteach(FTEACHCODE, FTEACHNAME, FGENDER, FDOB, FMOBILE, FEMAIL)
values('{$teachcode}', '{$name}', '{$gender}', date_format(str_to_date('{$dob}', '%d/%m/%Y'), '%Y-%m-%d'),
'{$mobile}', '{$email}')";
$resInsMas = $aobj_context->pobj_db->Execute($insMas);
$InsTab = "insert into tdvs_tabuser(FTEACHCODE, FNAME, FDOB, FMOBILENO, FEMAIL, fpasswd, fmenus, fusertype)
values('{$teachcode}', '{$name}', date_format(str_to_date('{$dob}', '%d/%m/%Y'), '%Y-%m-%d'),
'{$mobile}', '{$email}', '{$mobile}', '{$dataCond}', 'CHAIR')";
}else{
$InsTab = "update tdvs_tabuser set fmenus = '{$dataCond}' where FTEACHCODE = '{$teachercode}'";
}
$resInsTab = $aobj_context->pobj_db->Execute($InsTab);
if($resInsTab){
$arr['msg'] = "Successfully saved";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}else{
$arr['msg'] = "Something went wrong";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
function getTdvsUserMenu($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$query = "select t.id, t.fteachcode, m.fteachname, m.fmobile, date_format(m.fdob, '%d/%m/%Y')as fdob,
ifnull(m.fgender, '')as fgender, m.femail, ifnull(t.fmenus,'')as fmenus
from tdvs_masteach m inner join tdvs_tabuser t on m.fteachcode = t.fteachcode and
t.fmobileno = m.fmobile where fusertype = 'CHAIR'";
$res = $aobj_context->pobj_db->GetAll($query);
if($res){
echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
return;
}else{
$arr['msg'] = "No data found";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
function getMenuAndTeachDet($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$teachcode = $aobj_context->mobj_data['teachcode'];
$teachQry = "select fteachcode, fteachname, ifnull(fgender, '')as fgender,
fmobile, femail, fdob from tdvs_masteach
where fteachcode='{$teachcode}'";
$resTeach = $aobj_context->pobj_db->GetRow($teachQry);
$menuQry = "select m.fmenucode, m.fmenuname, ifnull(t.fteachcode, '')as fteachcode from tdvs_masmenu m
left join tdvs_tabuser t on INSTR(ifnull(t.fmenus, ''), concat(m.fmenucode, '*')) > 0
and t.fteachcode='{$teachcode}' where m.factive='T'";
$resMenu = $aobj_context->pobj_db->GetAll($menuQry);
if($resTeach || $resMenu){
$arr['teach'] = $resTeach;
$arr['menu'] = $resMenu;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}else{
$arr['msg'] = "No data found";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
function change_tdvs_user_pwd($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$oldpassword = $aobj_context->mobj_data['oldpassword'];
$newpassword = $aobj_context->mobj_data['newpassword'];
$teachcode = $aobj_context->mobj_data['teachcode'];
$slt = "select fpasswd from tdvs_tabuser
where fteachcode = '{$teachcode}' and fpasswd = '{$oldpassword}'";
$res = $aobj_context->pobj_db->GetRow($slt);
if($res['fpasswd'] === $oldpassword){
$query = "update tdvs_tabuser set fpasswd = '{$newpassword}'
where fteachcode = '{$teachcode}' and fpasswd = '{$oldpassword}'";
$result = $aobj_context->pobj_db->Execute($query);
if($result){
$arr['msg'] = "Password Changed Successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}
}else{
$arr['msg'] = "Something Went Wrong";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
function tdvs_getpwdstatus($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$teachcode = $aobj_context->mobj_data['teachcode'];
$slt = "select fpwdstatus from tdvs_tabuser
where fteachcode = '{$teachcode}'";
$res = $aobj_context->pobj_db->GetRow($slt);
if($res['fpwdstatus'] === 'T'){
$arr['msg'] = "success";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
return;
}else{
$arr['msg'] = "failed";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
}
?>
|