<?php
$unique_key = $_REQUEST['u']; 
session_start();
 date_default_timezone_set('Asia/Kolkata');
if(!isset($_SESSION[$unique_key]) || $_SESSION[$unique_key] !== true){
     header("location: ../Session_A.php");
    exit;
}
 
$fullname=htmlspecialchars($_SESSION["fullname"]);   

$user_image="headicon.jpg"; 

$user_id=htmlspecialchars($_SESSION["user_id"]);
$date_of_entry=date('d-m-Y');
?>

<?php
include('include/header.php');


?>
<body class="vertical dark" oncontextmenu="return false" onselectstart="return false" ondragstart="return false">
  <div class="wrapper">

    <?php
    include('include/sidebar.php')
    ?>
  
      <main role="main" class="main-content">
        <div class="container-fluid">
          <div class="row justify-content-center">
            <div class="col-12">
			<h2 class="h5 page-title">Welcome! <?php echo $fullname; ?></h2>
             
              <div class="card shadow mb-4">
               
                
             
			   <div class="row">
                <div class="col-md-12 my-4">
              
                  <div class="card shadow">
                    <div class="card-body">
                      <!-- table -->
                      <table class="table table-hover table-borderless border-v">
                        <thead class="thead-dark">
                          <tr>
                            <th>Sl.No</th>
                            <th>Name</th>
                           <th>Mobile Number</th>
						   <th>Email</th>
						   <th>Subject</th>
                          <th>Date</th>
						    <th>Status</th>
                            <th>Action</th>
                          </tr>
                        </thead>
                        <tbody>
						  <?php
				
					
							require_once "DBConfig.php";
							$result = mysqli_query($link,"SELECT * FROM cust_enq_table ORDER BY enq_id DESC");
							if(mysqli_num_rows($result)>0) {
							$i=0;
							while($row = mysqli_fetch_array($result)) {
					?>
					  
                          <tr class="collapsed" >
                            <td><?php echo ++$i; ?></td>
                            <td><?php echo $row["name"]; ?></td>
                            <td><?php echo $row["mobile"]; ?></td>
							 <td><?php echo $row["email_id"]; ?></td>
							  <td><?php echo $row["message"]; ?></td>
							  
							  
                          <td><?php echo $row["date_of_entry"]; ?></td>
						    <td><?php echo $row["status"]; ?></td>
                            
                            <td><button class="btn btn-sm dropdown-toggle more-horizontal" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                <span class="text-muted sr-only">Action</span>
                              </button>
                              <div class="dropdown-menu dropdown-menu-right">
                            <a class="dropdown-item" href="Customer_Enquiry_View.php?key=<?php echo $row["enq_id"]; ?>&u=<?php echo $unique_key; ?>">View</a> 
                              
                               
                              </div>
                            </td>
                          </tr>
                      <?php
						}
				}
				else
				{
   					
				}
			?>	
					     
                       
                        
                         
                        </tbody>
                      </table>
                    </div>
                  </div>
                </div>
              </div> <!-- end section -->
            </div> <!-- .col-12 -->
          </div> <!-- .row -->
        </div> <!-- .container-fluid -->
      
            </div>
          </div>
        </div>
      </main> <!-- main -->
    </div> <!-- .wrapper -->
  <?php 
  include('include/footer.php');
 
include('include/Script.php')
?>
  </body>
</html>