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.145.100.40


Current Path : /proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src/usersetupNew.php

<?php
function saveNewUser($aobj_context)
{
    session_start();	
    include_once("/JSON.php"); 
	$json = new Services_JSON();
	include("error_log.php");
	$College_Code = $_SESSION['collcode'];
	$funivcode = $_SESSION['FUNIVCODE'];

	$usrname= ($aobj_context->mobj_data["usrname"]);
	$pws   	= ($aobj_context->mobj_data["pws"]);
	$mob    = ($aobj_context->mobj_data["mob"]);
	$email  = ($aobj_context->mobj_data["email"]);
	$name  = ($aobj_context->mobj_data["name"]);
	$screen  = ($aobj_context->mobj_data["screen"]);
	$usertype  = ($aobj_context->mobj_data["usertype"]);

	if($funivcode == "055"){
			$uType = $usertype;
	}else{
		$uType = 17;
	}
	
	if($screen == 'add')
	{
		$query = "INSERT INTO s_sysdb (college_code, sysusr, sysusrkey, user_type, real_name, email_id, fmob)
		VALUES ('{$College_Code}', '{$usrname}', '{$pws}', '{$uType}', '{$name}', '{$email}', '{$mob}')";
		$res = $aobj_context->mobj_db->Execute($query);
	}else
	{
		$query = "update s_sysdb set real_name = '{$name}',
		email_id = '{$email}', fmob = '{$mob}', user_type='{$uType}'
		where college_code = '{$College_Code}'
		and sysusr = '{$usrname}'";
		$res = $aobj_context->mobj_db->Execute($query);

		if($funivcode == 'P005')
			{
				$query = "update masteach set FTEACHNAME='{$name}', FMOBILE = '{$mob}', FEMAIL='{$email}'
						  where FTEACHCODE = '{$usrname}'";
				$res = $aobj_context->mobj_db->Execute($query);
			
			}
	}

	if($res)
	{
		if($funivcode == '049' || $funivcode == '097' || $funivcode == 'P005' || $funivcode == 'P023' || $funivcode == '062' || $funivcode == '061')
		{	
			$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 == 'P023' || $funivcode == '062' || $funivcode == '061')
		{

			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 == 'P023')
			{
				$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);
			}else if($funivcode == '061')
			{
				$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);
			}else if($funivcode == '062')
			{
				$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 = '34080'
					AND s.sysusr = '{$usrname}'";
				$res1 = $aobj_context->mobj_db->Execute($query);
			}

			$query10 = "delete from logisys3_comexam.pushstud where FUNIVCODE='{$funivcode}' and fregno='{$usrname}'";
			$res10 = $aobj_context->mobj_db->Execute($query10);

			$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 viewUserDet($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	session_start();	
	$College_Code = $_SESSION['collcode'];
	$funivcode = $_SESSION['FUNIVCODE'];
		
	$e_data.="<table  width='100%' cellspacing='0' class='tr_ventor_row' cellpadding='0' border='0' >";
	$e_data.="<th align='left' colspan='6' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>User Created Details</th>";			
	$e_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";	
	$e_data.="<td  style='padding:2px; width:20px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Sl. No.</center></td>";
	$e_data.="<td  style='padding:2px; width:140px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>User ID</center></td>";
	$e_data.="<td  style='padding:2px; width:140px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>User Name</center></td>";
	$e_data.="<td  style='padding:2px; width:75px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Mobile No</center></td>";
	$e_data.="<td  style='padding:2px; width:200px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Email</center></td>";
	$e_data.="<td  style='padding:2px; width:90px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Action</center></td>";
	$e_data.="</tr>";

	$query = "select internal_code,sysusr,real_name,email_id,fmob 
	from s_sysdb where college_code = '{$College_Code}'
	and ifnull(user_type,'') = '17'";
	$result = $aobj_context->mobj_db->GetAll($query);

	if($result)
	{	
		$i = 1;
		foreach($result as $key=>$value)
		{
			$code   = $value['internal_code'];
			$sysusr    = $value['sysusr'];
			$real_name = $value['real_name'];
			$email_id  = $value['email_id'];
			$FMOBILE   = $value['fmob'];

			if($k==count($lobj_get_records))
			$border_bottom = "border-bottom:1px solid #C5DBEC;";	
			
			$e_data.="<tr class='ui-widget-content jqgrow' style='height: 20px;'>";
			$e_data.="<td align='center' style='{$border_bottom}; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:2px;'>$i</td>";
			$e_data.="<td align='left' style='{$border_bottom};border-right:1px solid #C5DBEC; padding:2px;'> $sysusr </td>";
			$e_data.="<td align='left' style='{$border_bottom};border-right:1px solid #C5DBEC;  padding:2px;'>$real_name</td>";
			$e_data.="<td align='center' style='{$border_bottom};border-right:1px solid #C5DBEC;  padding:2px;'>$FMOBILE</td>";
			$e_data.="<td align='left' style='{$border_bottom};border-right:1px solid #C5DBEC;  padding:2px;'>$email_id</td>";
			$e_data.="<td align='center' style='{$border_bottom};border-right:1px solid #C5DBEC;  padding:2px;'><buttuon 
			style = 'background-color: #008cba;
			border: none;
			color: white;
			padding: 4px 10px;
			text-align: center;
			text-decoration: none;
			display: inline-block;
			font-size: 12px;
			cursor: pointer;
			border-radius: 3px;'
			onclick = 'editUserDet(\"$sysusr\",\"$real_name\",\"$FMOBILE\",\"$email_id\")'>Edit</buttuon>
			<buttuon 
			style = 'background-color: #cd0a0a;
			border: none;
			color: white;
			padding: 4px 10px;
			text-align: center;
			text-decoration: none;
			display: inline-block;
			font-size: 12px;
			cursor: pointer;
			border-radius: 3px;'
			onclick = 'DeleteUserDet(\"$code\",\"$sysusr\",\"$real_name\",\"$FMOBILE\",\"$email_id\")'>Delete</buttuon>
			</td>";
			$e_data.="</tr>";
			$i++;
		}

		
	}else
	{
		$e_data.="<tr style='height: 20'>";
		$e_data.="<td colspan='6' align = 'center'>No User Created</td>";
		$e_data.="</tr>";
	}
	$e_data.="</table><br>";		

	$arr['html'] = $e_data;
	echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	return; 

}

function saveNewPws($aobj_context)
{

	include("error_log.php");
	$College_Code = $_SESSION['collcode'];
	$userid = $_SESSION['user_id'];
	$funivcode = $_SESSION['FUNIVCODE'];

	$opws = trim($aobj_context->mobj_data["opws"]);
	$pws   	= trim($aobj_context->mobj_data["pws"]);

	$query = "select * from s_sysdb where internal_code = '{$userid}' and sysusrkey = '{$opws}'";
	$result = $aobj_context->mobj_db->GetRow($query);
	$college_code = $result['college_code'];
	
	if($result)
	{

	}else
	{
		$rdata = "Old Password Not Matching";
		print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
		return $rdata;	
	}

	$query = "update s_sysdb set sysusrkey = '{$pws}'
		where college_code = '{$college_code}'
		and internal_code = '{$userid}'";
	$res = $aobj_context->mobj_db->Execute($query);
	
	if($res)
	{
		
		$rdata = "Updated Successfully.";
		print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
		return $rdata;
	}
	else
	{
		$rdata = "No Updation Please Try After Sometime";
		print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
		return $rdata;			
	}	
}

function DeleteUserDet($aobj_context){
	session_start();	
	$College_Code = $_SESSION['collcode'];
	$internalcode = $aobj_context->mobj_data["code"];
	$usrname = $aobj_context->mobj_data["usrname"];
    $mob = $aobj_context->mobj_data["mob"];
    $email = $aobj_context->mobj_data["email"];
    $name = $aobj_context->mobj_data["name"];

    $query="	DELETE FROM s_sysdb
				WHERE internal_code='{$internalcode}' and 
				college_code = '{$College_Code}' and  
				sysusr='{$usrname}'
				AND IFNULL(user_type, '') = '17';";
				
     $result=$aobj_context->mobj_db->Execute($query);

	 if($result){
		$rdata['msg'] = "User ID Deleted Successfully";
			echo $aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"); 
		}
	else{
		$data['msg'] = 'Could Not Delete the User ID';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
	}

}

?>