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


Current Path : /var/www/html/dud/
Upload File :
Current File : /var/www/html/dud/studymatstatisticsdet.php

<?php
//lib16107 lib16103

ini_set('display_errors', 'on');
ini_set('memory_limit','900M');
ini_set('max_execution_time',0);

$type = $_GET['type'];
// $servername = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
// $username   = "admin";
// $password  = "Logisys2104";


include ("/var/www/config.php");
$servername = SERVERNAME;
$username   = USERNAME;
$password  = PASSWORD;

/*$servername = "localhost";
$username   = "root";
$password  = "";*/

$conn = new  mysqli($servername,$username,$password);
if(!$conn) 
{
    die("Connection failed: " . mysqli_connect_error());
}

$admdb = "logisys3_dud";



if($type == 'deg')
{
    $query = "select d.fdegree,d.fdescpn,d.fexamname,
    if(ifnull(o.`FDEGREE`,'') = '','Not Uploaded','Uploaded') as upd 
    from {$admdb}.degree d left join {$admdb}.osmmain o on d.fdegree = o.fdegree
    and d.fexamno = o.fexamno 
    where d.fdeggrp = 'PG'
    and d.fexamno in('B','D')
    order by upd;";

}else if($type == 'stud')
{
    $query = "select d.fdegree, d.fdescpn, 
    count(distinct s.fregno) student_count, 
    sum(if(ifnull(o.fregno,'') = '',0,1)) as viewed 
    from {$admdb}.degree d 
    inner join {$admdb}.student s on d.fdegree = s.fdegree 
    left join {$admdb}.osmdetl o  on d.fdegree = o.fdegree
    and s.fregno = o.fregno 
    and d.fexamno = left(fsubcode,1)
    where d.fdeggrp = 'PG' 
    and d.fexamno in('B','D')
    group by d.fdegree
    order by s.fdegree";

}else if($type == 'degupd')
{
    $query = "select date_format(o.FCREATEDATE,'%d.%m.%Y') as upddate, o.FDEGREE,d.fdescpn,d.fexamname,
    o.FUPDDEPT,count(distinct o.FPATH) as cnt
    from {$admdb}.osmmain o inner join {$admdb}.degree d on o.fdegree = d.fdegree and o.fexamno = d.fexamno
    where ifnull(o.FAPPRSTATUS,'')  = 'approved'
    group by o.fdegree,o.fexamno,date_format(o.FCREATEDATE,'%d.%m.%Y')
    order by date_format(o.FCREATEDATE,'%d.%m.%Y') desc";
}

// var_dump($query);
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);


if($count >0)
{
	$i = 0;
	$y = 1;
	$nodata=0;
	$apprready=0;
	$c1=0;
	$c2=0;
	$c3=0;
	$c4=0;
	$c5=0;
	$c6=0;
	$c7=0;
	$c8=0;
	
	$table = '<center><h2>DAVANGERE UNIVERSITY</h2>
	<h2>Study Material Statistics</h2>';
	echo  $table;	
    if($type == 'deg')
    {
	$table = '
		<style>
			table{
			width:100%;
			table-layout: fixed;
			}
		</style>	
		<table style="text-align: left;width: 100%;"  border="1" cellpadding="10" cellspacing="0">
			<thead style = "">
				<tr style = "background-color:#8acc51">
					<th width="5%" align="center"><b>Sl. No.</b></th>
                    <th width="5%"  align="center"><b>Degree Code</b></th>
                    <th width="30%"  align="center"><b>Degree Name</b></th>
					<th  width="30%" align="center"><b>Exam Name</b></th>
					<th  align="center"><b>Status</b></th>
				</tr>
			</thead>
		</table>
				
		<table style="text-align: left;width: 100%;"  border="1" cellpadding="10" cellspacing="0">
		<tbody >';	
        }else if($type == 'stud')
        {
            $table = '
            <style>
                table{
                width:100%;
                table-layout: fixed;
                }
            </style>	
            <table style="text-align: left;width: 100%;"  border="1" cellpadding="10" cellspacing="0">
                <thead style = "">
                    <tr style = "background-color:#8acc51">
                        <th width="5%" align="center"><b>Sl. No.</b></th>
                        <th width="5%"  align="center"><b>Degree Code</b></th>
                        <th width="30%"  align="center"><b>Degree Name</b></th>
                        <th  width="30%" align="center"><b>Student Count</b></th>
                        <th  align="center"><b>Viewed Count</b></th>
                    </tr>
                </thead>
            </table>
                    
            <table style="text-align: left;width: 100%;"  border="1" cellpadding="10" cellspacing="0">
            <tbody >';
        }else if($type == 'degupd')
        {
            $table = '
            <style>
                table{
                width:100%;
                table-layout: fixed;
                }
            </style>	
            <table style="text-align: left;width: 100%;"  border="1" cellpadding="10" cellspacing="0">
                <thead style = "">
                    <tr style = "background-color:#8acc51">
                        <th width="15%" align="center"><b>Upload Date</b></th>
                        <th width="10%"  align="center"><b>Degree Code</b></th>
                        <th width="30%"  align="center"><b>Degree Name</b></th>
                        <th  width="20%" align="center"><b>Semester</b></th>
                        <th  width="30%" align="center"><b>Department Name</b></th>
                        <th  width="10%" align="center"><b>Upload Count</b></th>
                    </tr>
                </thead>
            </table>
                    
            <table style="text-align: left;width: 100%;"  border="1" cellpadding="10" cellspacing="0">
            <tbody >';
        }
	$i = 1;
	while($row = mysqli_fetch_assoc($result))
	{

        if($type == 'deg')
        {
            $table .= '<tr><td width="5%" align="center">'.$i.'</td>
                <td  width="5%" align="center">'.$row['fdegree'].'</td>
                <td width="30%" align="left">'.$row['fdescpn'].'</td>
                <td align="center">'.$row['fexamname'].'</td>					
                <td  align="center">'.$row['upd'].'</td>
            </tr>';
        }else if($type == 'stud')
        {
            $table .= '<tr><td width="5%" align="center">'.$i.'</td>
			<td  width="5%" align="center">'.$row['fdegree'].'</td>
			<td width="30%" align="left">'.$row['fdescpn'].'</td>
			<td align="center">'.$row['student_count'].'</td>					
			<td  align="center">'.$row['viewed'].'</td>
            </tr>';
        }else if($type == 'degupd')
        {
            $table .= '<tr><td width="15%" align="center">'.$row['upddate'].'</td>
			<td  width="10%" align="center">'.$row['FDEGREE'].'</td>
			<td width="30%" align="left">'.$row['fdescpn'].'</td>
			<td width="20%" align="center">'.$row['fexamname'].'</td>					
            <td width="30%" align="left">'.$row['FUPDDEPT'].'</td>
            <td width="10%" align="center">'.$row['cnt'].'</td>
            </tr>';
        }
		$i++;
	}
	echo $table;
		
}


?>