<?php

    session_start();

    include "../db.php";

    date_default_timezone_set('Asia/Kolkata');

    $currentTime = date('M j, Y g:i a');



    if ( !isset($_SESSION['uid']) && !isset($_SESSION['uref']) && !isset($_SESSION['utype']) && !isset($_SESSION['uname']) )

        header("Location: logout.php");



    $u_sql = "SELECT sclass,admin_ref FROM users WHERE uref = '$_SESSION[uref]'";

    $u_result = mysqli_query($con, $u_sql);

    $u_row = mysqli_fetch_assoc($u_result);

    $userClass = $u_row["sclass"];

    $admin_2 = $u_row["admin_ref"];



?>

<!DOCTYPE html>

<html lang="en">

<head>

 <?php include "includes/meta.php"; ?>        

    <?php include "includes/css.php"; ?>      

  



</head>

<body id="page-top" class="mt-55">



    <div style="margin-top: 70px;"></div>



      <?php include "includes/header2.php"; ?>





<div cl ass="container-fluid ">       

   <div class="row mx-0 justify-content-center mt-2">

        <div class="col-12 col-sm-8 col-md-8">

            <h1 class="h3 mb-2 text-gray-800 text-center">Homework Subjects</h1>

                    <hr>

            <div class="row mx-0 justify-content-center mt-2 gx-1">



            <?php

                $sql = "SELECT * FROM subject WHERE uploadedby = '$admin_2' AND sc_class_id = '$userClass' ORDER BY sc_id DESC";

                $res = mysqli_query($con,$sql);

                if ($total_rows=mysqli_num_rows($res)>0) {

                    $c = 1;

                    while ($rows = mysqli_fetch_assoc($res)) {

                        $showSubject= showSubject($con,$rows['sc_id']);

            ?>

                <div class="col-6 col-sm-6 col-xs-6 col-md-6 text-center md">  

                    <a href="view-homework.php?sid=<?php echo $rows['sc_id']; ?>" style="text-decoration: none;">    

                      

                      <p class="cd1"><i class="fa fa-book" aria-hidden="true"></i>  <?php echo $showSubject; ?></p>                 

                    </a>        

                </div>



            <?php 

                     $c++;

                    }

                }

            ?>



     

            </div>

        </div>

     </div>

</div> 



            <?php include "includes/ft.php"; ?>

            <?php include "includes/js.php"; ?>



</body>

</html>











