0xV3NOMx
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.22.42.25


Current Path : /proc/thread-self/root/var/www/html/collportal/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/collportal/src/saveUserSetup.php

<?php
	function saveUserSetupdata($aobj_context){
		session_start();
		$funivcode = $aobj_context->mobj_data['FUNIVCODE'];
		$College_Code = $aobj_context->mobj_data['collcode'];
		$usrname= ($aobj_context->mobj_data["id"]);
		$pws   	= ($aobj_context->mobj_data["password"]);
		$mob    = ($aobj_context->mobj_data["mobileno"]);
		$email  = ($aobj_context->mobj_data["emailid"]);
		$name  = ($aobj_context->mobj_data["name"]);
		$screen  = ($aobj_context->mobj_data["add"]);
		$usertype  = ($aobj_context->mobj_data["usertype"]);
		
		$user = explode('-', $usrname);
	
		if($funivcode == "055"){
				$uType = $usertype;
		}else{
			$uType = 17;
		}
		
		if($screen == 'add')
		{

			$qry="SELECT fuser FROM col_masuser where fuser='{$usrname}'";
			$result = $aobj_context->mobj_db->GetRow($qry);
			
            if($result['fuser']==$usrname){
				
			$query = "update col_masuser set fpassword = '{$pws}',femail= '{$email}',fmobileno = '{$mob}',fusertype='{$user[0]}',fname = '{$name}'
					  where fcollcode = '{$College_Code}' and  fuser='{$user[1]}'";
				
			}else{
				$query = "INSERT INTO col_masuser (fcollcode, fuser, fpassword, fusertype, fmobileno,fname,femail)
			              VALUES ('{$College_Code}', '{$user[1]}', '{$pws}', '{$user[0]}', '{$mob }','{$name}','{$email}' )";
			}

		

			$res = $aobj_context->mobj_db->Execute($query);
		}else
		{ 
			 
			$query = "update col_masuser set fpassword = '{$pws}'
			where college_code = '{$College_Code}' and email_id = '{$email}' and fmob = '{$mob}' and  user_type='{$uType}
			and sysusr = '{$usrname}'";

			// $query = "update col_masuser set fpassword = '{$pws}',
			// email_id = '{$email}', fmob = '{$mob}', user_type='{$uType}'
			// where college_code = '{$College_Code}'
			// and sysusr = '{$usrname}'";
			$res = $aobj_context->mobj_db->Execute($query);
		}
	
		if($res)
		{
			if($funivcode == '049' || $funivcode == '097' || $funivcode == 'P005' || $funivcode == 'P006')
			{	
				$query = "INSERT ignore INTO masteach (FCOLLCODE, FTEACHCODE, FTEACHNAME, FMOBILE,FEMAIL)
				VALUES ('{$College_Code}', '{$usrname}', '{$name}', '{$mob}','{$email}')";
				$res1 = $aobj_context->mobj_db->Execute($query);
	
			}
	
			if($funivcode == '097' || $funivcode == 'P005' || $funivcode == 'P006')
			{
	
				if($funivcode == '097')
				{
					$query = "INSERT ignore INTO user_rights (college_code, ref_s_sysdb_code, module_type, module_id, group_id, is_view, is_view_group_records, is_view_dep_records, is_view_all_records, is_add, is_edit, is_edit_group_records, is_edit_dep_records, is_edit_all_records, is_del, is_del_group_records, is_del_dep_records, is_del_all_records)
						SELECT s.college_Code,s.internal_code,module_type, module_id, group_id, is_view, is_view_group_records, is_view_dep_records, is_view_all_records, is_add, is_edit, is_edit_group_records, is_edit_dep_records, is_edit_all_records, is_del, is_del_group_records, is_del_dep_records, is_del_all_records FROM s_sysdb s, user_rights r
						WHERE s.user_type = '17' 
						and r.ref_s_sysdb_code = '33897'
						AND s.sysusr = '{$usrname}'";
					$res1 = $aobj_context->mobj_db->Execute($query);
				}else if($funivcode == 'P005')
				{
					$query = "INSERT ignore INTO user_rights (college_code, ref_s_sysdb_code, module_type, module_id, group_id, is_view, is_view_group_records, is_view_dep_records, is_view_all_records, is_add, is_edit, is_edit_group_records, is_edit_dep_records, is_edit_all_records, is_del, is_del_group_records, is_del_dep_records, is_del_all_records)
						SELECT s.college_Code,s.internal_code,module_type, module_id, group_id, is_view, is_view_group_records, is_view_dep_records, is_view_all_records, is_add, is_edit, is_edit_group_records, is_edit_dep_records, is_edit_all_records, is_del, is_del_group_records, is_del_dep_records, is_del_all_records FROM s_sysdb s, user_rights r
						WHERE s.user_type = '17' 
						and r.ref_s_sysdb_code = '33891'
						AND s.sysusr = '{$usrname}'";
					$res1 = $aobj_context->mobj_db->Execute($query);
				}else if($funivcode == 'P006')
				{
					$query = "INSERT ignore INTO user_rights (college_code, ref_s_sysdb_code, module_type, module_id, group_id, is_view, is_view_group_records, is_view_dep_records, is_view_all_records, is_add, is_edit, is_edit_group_records, is_edit_dep_records, is_edit_all_records, is_del, is_del_group_records, is_del_dep_records, is_del_all_records)
						SELECT s.college_Code,s.internal_code,module_type, module_id, group_id, is_view, is_view_group_records, is_view_dep_records, is_view_all_records, is_add, is_edit, is_edit_group_records, is_edit_dep_records, is_edit_all_records, is_del, is_del_group_records, is_del_dep_records, is_del_all_records FROM s_sysdb s, user_rights r
						WHERE s.user_type = '17' 
						and r.ref_s_sysdb_code = '33898'
						AND s.sysusr = '{$usrname}'";
					$res1 = $aobj_context->mobj_db->Execute($query);
				}
	
				$query = "INSERT ignore INTO logisys3_comexam.pushstud 
				(FUNIVCODE, FREGNO, FDEGREE, FCOLLCODE, FNAME, FMOBILE, FEMAIL, FUSERTYPE)
				select '{$funivcode}',FTEACHCODE, '{$funivcode}','{$funivcode}',FTEACHNAME, FMOBILE,FEMAIL,'600' 
				from masteach where ifnull(fdeleted,'') <> 'T'";
				$res1 = $aobj_context->mobj_db->Execute($query);
			
				
			}
	
			$rdata = "Updated Successfully.";
			print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
			return $rdata;
		}
		else
		{
			$rdata = "No Updation / Add..!";
			print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
			return $rdata;			
		}			
	}	
	
	function userLoginDet($aobj_context){

		$funivcode = $aobj_context->mobj_data['univcode'];
		$College_Code = $aobj_context->mobj_data['collcode'];

		$query="SELECT *FROM col_masuser where fcollcode='{$College_Code}'";
		$res = $aobj_context->mobj_db->GetAll($query);

		if($res){
            echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
            return;
        }else{
            $arr['msg'] = "Something Went Wrong";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
            return;
        }
	}

	function userDeleteData($aobj_context){
		$funivcode = $aobj_context->mobj_data['FUNIVCODE'];
		$College_Code = $aobj_context->mobj_data['collcode'];
		$usrname= ($aobj_context->mobj_data["id"]);
		$pws   	= ($aobj_context->mobj_data["password"]);
		$mob    = ($aobj_context->mobj_data["mobileno"]);
		$email  = ($aobj_context->mobj_data["emailid"]);
		$name  = ($aobj_context->mobj_data["name"]);
		$screen  = ($aobj_context->mobj_data["add"]);
		$usertype  = ($aobj_context->mobj_data["usertype"]);

		$qry="DELETE FROM col_masuser WHERE fuser='{$usrname}'";
		$res = $aobj_context->mobj_db->Execute($qry);

		if($res){
			$arr['msg'] = "Successfully Deleted";
            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 userTypeData($aobj_context){
		$collcode=$aobj_context->mobj_data['collcode'];

		$qry = "SELECT fdescpn AS `key`, CONCAT(fusertype,'-',fdescpn)AS `value`, CONCAT(fusertype,'-',fdescpn)AS `label`  FROM col_usertype";
		$res=$aobj_context->mobj_db->GetAll($qry);

		if($res){
            echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
            return;
        }else{
            $arr['msg'] = "Something Went Wrong";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
            return;
        }

	}
?>