<?php
include("sess_page.php");
include("include/protect.php");
include("include/dbconnect.php");
$uname=$_SESSION['uname'];
extract($_POST);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php include("include/title.php"); ?></title>
<link href="style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="include/menu.js"></script>
<style type="text/css">
<!--
.style3 {font-size: 16px}
-->
</style>
<link rel="stylesheet" href="../css/bootstrap.min.css">
    <!-- Site CSS -->
    <link rel="stylesheet" href="../css/style.css">
    <!-- Responsive CSS -->
    <link rel="stylesheet" href="../css/responsive.css">
    <!-- Custom CSS -->
    <link rel="stylesheet" href="../css/custom.css">
</head>

<body> 

<header class="main-header">
        <!-- Start Navigation -->
        <nav class="navbar navbar-expand-lg navbar-light bg-light navbar-default bootsnav">
            <div class="container">
                <!-- Start Header Navigation -->
                <div class="navbar-header">
                    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-menu" aria-controls="navbars-rs-food" aria-expanded="false" aria-label="Toggle navigation">
                    <i class="fa fa-bars"></i>
                </button>
                    <a class="navbar-brand" href="index.html"><img src="../images/logo.png" class="logo" alt=""></a>
                </div>
                <!-- End Header Navigation -->

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="navbar-menu">
                    <ul class="nav navbar-nav ml-auto" data-in="fadeInDown" data-out="fadeOutUp">
                        <li class="nav-item active"><a class="nav-link" href="index.php">Home</a></li>
                        <li class="dropdown">
                            <a href="#" class="nav-link " data-toggle="dropdown">PRODUCTS</a>
                            <ul class="dropdown-menu">
								<li><a href="add_cat.php">Add Category</a></li>
								<li><a href="add_products.php">Add Products</a></li>
                                <li><a href="view_products.php">View Products</a></li>
                              
                            </ul>
                        </li>
                        
                        <li class="dropdown">
						<a class="nav-link" href="admin.php" ata-toggle="dropdown">Info</a>
						<ul class="dropdown-menu">
								<li><a href="user_details.php">User Information</a></li>
								<li><a href="admin_view_purchase_user.php">View Products for user</a></li>
                                <li><a href="tot_Sell.php">Total sales</a></li>
                                <li><a href="admin_qut_status.php">Stock Quantity Status</a></li>
                            </ul>
						</li>
                        <li class="nav-item"><a class="nav-link" href="../index.html" >Logout</a></li>
                    </ul>
                </div>
                <!-- /.navbar-collapse -->

               
                <!-- End Atribute Navigation -->
            </div>
            <!-- Start Side Menu -->
            <div class="side">
                <a href="#" class="close-side"><i class="fa fa-times"></i></a>
                <li class="cart-box">
                    <ul class="cart-list">
                        <li>
                            <a href="#" class="photo"><img src="../images/bg2.jpg" class="cart-thumb" alt="" /></a>
                            <h6><a href="#">Delica omtantur </a></h6>
                            <p>1x - <span class="price">$80.00</span></p>
                        </li>
                        <li>
                            <a href="#" class="photo"><img src="../images/bg1.jpg" class="cart-thumb" alt="" /></a>
                            <h6><a href="#">Omnes ocurreret</a></h6>
                            <p>1x - <span class="price">$60.00</span></p>
                        </li>
                        <li>
                            <a href="#" class="photo"><img src="../images/bg1.jpg" class="cart-thumb" alt="" /></a>
                            <h6><a href="#">Agam facilisis</a></h6>
                            <p>1x - <span class="price">$40.00</span></p>
                        </li>
                        <li class="total">
                            <a href="#" class="btn btn-default hvr-hover btn-cart">VIEW CART</a>
                            <span class="float-right"><strong>Total</strong>: $180.00</span>
                        </li>
                    </ul>
                </li>
            </div>
            <!-- End Side Menu -->
        </nav>
        <!-- End Navigation -->
    </header>
    <!-- End Main Top -->

    <!-- Start Top Search -->
    <div class="top-search">
        <div class="container">
            <div class="input-group">
                <span class="input-group-addon"><i class="fa fa-search"></i></span>
                <input type="text" class="form-control" placeholder="Search">
                <span class="input-group-addon close-search"><i class="fa fa-times"></i></span>
            </div>
        </div>
    </div>
    <!-- End Top Search -->

    <!-- Start Slider -->
    <div id="slides-shop" class="cover-slides">
        <ul class="slides-container">
            <li class="text-center">
                <img src="../images/bg1.jpg" alt="">
                <div class="container">
                    <div class="row">
                        <div class="col-md-12">
                            <h1 class="m-b-20"><strong>Welcome To <br> Freshshop</strong></h1>
                            <p class="m-b-40">See how your users experience your website in realtime or view <br> trends to see any changes in performance over time.</p>
                           
                        </div>
                    </div>
                </div>
            </li>
            
            <li class="text-center">
                <img src="../images/bg3.jpg" alt="">
                <div class="container">
                    <div class="row">
                        <div class="col-md-12">
                            <h1 class="m-b-20"><strong>Welcome To <br> Freshshop</strong></h1>
                            <p class="m-b-40">See how your users experience your website in realtime or view <br> trends to see any changes in performance over time.</p>
                            
                        </div>
                    </div>
                </div>
            </li>
        </ul>
        
    </div>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
   
    <tr>
      <td align="center" valign="top"><p>&nbsp;</p>
        <p class="style1"><form id="form1" name="form1" method="post" action="">
          <select name="day1" class="form-control">
            <option value="">-All-</option>
            <?php
			$dq3=mysql_query("select distinct(day1) from user_purchase where day1!=0");
			while($dr3=mysql_fetch_array($dq3))
			{
			?>
            <option <?php if($dr3['day1']==$day1) echo "selected"; ?>><?php echo $dr3['day1']; ?></option>
            <?php
			}
			?>
          </select>
&nbsp;
<select name="month1" class="form-control">
  <option value="">-All-</option>
  <?php
			$dq1=mysql_query("select distinct(month1) from user_purchase ");
			while($dr1=mysql_fetch_array($dq1))
			{
			?>
  <option <?php if($dr1['month1']==$month1) echo "selected"; ?>><?php echo $dr1['month1']; ?></option>
  <?php
			}
			?>
</select>
&nbsp;
<select name="year1" class="form-control">
  <option value="">-All-</option>
  <?php
			$dq2=mysql_query("select distinct(year1) from user_purchase where year1!=0");
			while($dr2=mysql_fetch_array($dq2))
			{
			?>
  <option <?php if($dr2['year1']==$year1) echo "selected"; ?>><?php echo $dr2['year1']; ?></option>
  <?php
			}
			?>
</select>
&nbsp;<p>&nbsp;</p>
<input type="submit" name="btn" value="Submit" class="btn hvr-hover" />
</form>
        </p>
        <p class="style1">&nbsp;</p>
        <p class="style1"><?php echo $msg; ?></p>
        <table width="646" height="99" border="0" cellpadding="0" cellspacing="0" class="table">
          <tr>
            <th height="39" colspan="4" scope="col"><span class="style3">Purchase  Ranking </span></th>
          </tr>
		  <thead class="thead-dark">
          <tr>
            <th width="150" height="29" scope="col">Product Name </th>
            <th width="162" scope="col">No. of quantity </th>
            <th width="162" scope="col">Price</th>
            
          </tr>
		</thead>
		<?php
		  if(isset($btn))
		  {
		  				if($day1!="" && $month1!="" && $year1!="")
						{
$qry="select * from user_purchase where day1='$day1' && month1='$month1' && year1='$year1' order by id desc";
						}
						else if($month1!="" && $year1!="")
						{
$qry="select * from user_purchase where month1='$month1' && year1='$year1' order by id desc";						
						}
						else
						{
						$qry="select * from user_purchase where year1='$year1' order by id desc";	
						}
     $result=mysql_query($qry);
	 
	 

while($row=mysql_fetch_array($result))
{


?>
       
          <tr>
            <td height="29"><?php echo $row['pname']; ?></td>
            <td align="center"><?php echo $row['uqut']; ?></td>
            <td align="center"><?php echo $row['price']; ?></td>
           
          </tr>
		  <?php
		
		}}
		
		?>
        </table>
		
        <blockquote>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
      </blockquote></td>
    </tr>
    <tr>
      <td align="center" >&nbsp;</td>
    </tr>
  </table> <div class="footer-copyright">
        <p class="footer-company">&nbsp;</p>
    </div>

<script src="../js/jquery-3.2.1.min.js"></script>
    <script src="../js/popper.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <!-- ALL PLUGINS -->
    <script src="../js/jquery.superslides.min.js"></script>
    <script src="../js/bootstrap-select.js"></script>
    <script src="../js/inewsticker.js"></script>
    <script src="../js/bootsnav.js."></script>
    <script src="../js/images-loded.min.js"></script>
    <script src="../js/isotope.min.js"></script>
    <script src="../js/owl.carousel.min.js"></script>
    <script src="../js/baguetteBox.min.js"></script>
    <script src="../js/form-validator.min.js"></script>
    <script src="../js/contact-form-script.js"></script>
    <script src="../js/custom.js"></script>
</body>
</html>










