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 : 18.119.28.173


Current Path : /var/www/misc/public_html/oums_old/phpscript/
Upload File :
Current File : /var/www/misc/public_html/oums_old/phpscript/user_logs.php

<?php
	include("sys_session.php");
	include("sys_connect.php");	
	include("sys_mainphp.php");															
	$load_data=$_POST["load_data"];
	$resp_mesg="";
	$resp_stat="";
	$resp_file="";

	if($load_data=='dept_data')
	{
		if($type_id=='ADMIN')
		{
		$mysql="select * from masdept where fdeptcode<>'ADMN' order by fdeptname";
		}
		elseif($type_id=='CHIEF')
		{
		$mysql="select * from masdept where fdepthead='$empl_id' and fdeleted<>'T' order by fdeptname";
		}		
		else
		{
		$mysql="select * from masdept where fdeptcode='$dept_id' and fdeleted<>'T' order by fdeptcode";
		}
		$myres=mysqli_query($mycon,$mysql);
		if(mysqli_num_rows($myres)>1)
		{
			echo "<option value=%>ALL</option>";
		}		
		while($row = mysqli_fetch_assoc($myres))
		{
			echo "<option value='$row[fdeptcode]'>$row[fdeptname]</option>";
		}
	}

	if($load_data=='user_data')
	{
		$dept_code=$_POST["dept_code"];	
				
		$mysql = "";
		$mysql.= "select femplname,femplcode,fdepthead from masempl,masdept where masempl.fdeptcode like '$dept_code' ";
		if($type_id=="ADMIN")
		{
		$mysql.= "and masempl.fdeptcode=masdept.fdeptcode ";
		}
		elseif ($type_id=="CHIEF") 
		{
		$mysql.= "and masempl.fdeptcode=masdept.fdeptcode and masdept.fdepthead = '$empl_id' ";
		}
		else
		{
		$mysql.= "and masempl.fdeptcode=masdept.fdeptcode and masempl.fdeptcode = '$dept_id' ";
		}
		$mysql.= "and ifnull(fusercode,'')<>'' order by femplname";				
		$myres=mysqli_query($mycon,$mysql);
		if(mysqli_num_rows($myres)>1)
		{
			if($type_id=='ADMIN')
			{echo "<option value=%>ALL</option>";}
			elseif($type_id=='CHIEF')
			{echo "<option value=%>ALL</option>";}
			else
			{echo "<option value=0>--Select--</option>";}			
		}		
		while($row = mysqli_fetch_assoc($myres))
		{
			echo "<option value='$row[fusercode]'>$row[femplname]</option>";
		}
	}	
	
	if($load_data=='view_data')
	{
		$dept_code=$_POST['dept_code'];
		$user_code=$_POST['user_code'];		
		$logs_type=$_POST['logs_type'];
		$logs_dat1=$_POST['logs_dat1'];		
		$logs_dat2=$_POST['logs_dat2'];				

		$mysql = "";
		$mysql.= "select sys_logs_user.*,fdepthead from sys_logs_user,masdept where sys_logs_user.fdeptcode like '$dept_code' ";
		$mysql.= "and fusercode like '$user_code' and ";
		$mysql.= "left(flogsdate,10) between str_to_date('$logs_dat1','%d-%m-%Y') and str_to_date('$logs_dat2','%d-%m-%Y') ";
		$mysql.= "";						
		if($type_id=="ADMIN")
		{
		$mysql.= "and sys_logs_user.fdeptcode=masdept.fdeptcode ";
		}
		elseif ($type_id=="CHIEF") 
		{
		$mysql.= "and sys_logs_user.fdeptcode=masdept.fdeptcode and masdept.fdepthead = '$empl_id' ";
		}
		else
		{
		$mysql.= "and sys_logs_user.fdeptcode=masdept.fdeptcode and sys_logs_user.fdeptcode = '$dept_id' ";
		}		
		$mysql.= "and flogstype like '$logs_type' and sys_logs_user.fdeleted='F' order by flogsdate";
		
		$myres=mysqli_query($mycon,$mysql);
		$mycnt=mysqli_num_rows($myres);
		if($mycnt==0)
		{
			echo "No records found!";
		}
		else
		{
			$resp_stat="T";
			echo "<table class=table_list border=1>";
			echo "<tr>";
			echo "<th> # </th>";
			echo "<th> Date & Time</th>";												
			echo "<th> Dept Code</th>";																			
			echo "<th> User ID </th>";																						
			echo "<th> Remarks </th>";	
			echo "<th> IP Address </th>";				
			echo "</tr>";
			$i=1;
			while($row = @mysqli_fetch_assoc($myres))	
			{
				$logs_date=date('d-m-Y h:i:s A',strtotime($row['flogsdate']));
				
				echo "<tr>";
				echo "<td width=5% align=center> $i</td>";
				echo "<td width=20% align=center>$logs_date</td>";
				echo "<td width=10% align=center>$row[fdeptcode]</td>";
				echo "<td width=15% align=center>$row[fusercode]</td>";				
				echo "<td width=30% align=left>$row[fremarks]</td>";
				echo "<td width=30% align=left>$row[flogsipad]</td>";				
				echo "</tr>";
				$i++;
			}				
		}
	}			
?>