<?php
	ob_start();
	session_start();
	
	//Included Files
	include("admin.php");
	
	include("dbConnection.php");
	
	//Declaring Variables
	$adminId;
	$message = "";
	$success = "";
	$failure = "";
	$dbHintQuestion;
	$dbName;
	$recordSet;
	$billId = "";
	$amount = "";
	$NA = "<font color = 'red'>Not Available</font>";
	
	$filePath;
	$fileName;
	$pageSize;
	
	//Retrieving Session Variable
	if(isset($_SESSION["adminId"]))
	{
		$adminId = $_SESSION["adminId"];
		//echo $adminId;
	}
	else
	{
		header('Location:index.php?message=Unauthorised%20Access%20Prohibited');
	}
	
	//Retrieving Query String Variable
	if(isset($_REQUEST["message"]))
	{
		$message = $_REQUEST["message"];
	}
	//echo $message;
	
	//Retrieving Query String Variable
	if(isset($_REQUEST["success"]))
	{
		$success = $_REQUEST["success"];
	}
	
	if(isset($_REQUEST["failure"]))
	{
		$failure = $_REQUEST["failure"];
	}
	
	//Creating 'dbConnection' Object
	$dbObj = new dbConnection();
	$con = $dbObj->getConnection();
	//echo $con . "<br/>";
	
	if($con)
	{
		//echo "MySQL Server Connected<br/>";
		$dbResult = $dbObj->selectDatabase();
		if($dbResult)
		{
			//Creating 'admin' Object
			$adminObj = new admin();
			
			
			$recordSet = $adminObj->getAllAdminDetails($con);
			
		}
		else
		{
			echo mysql_errno() . " : " . mysql_error();
		}
	}
	else
	{
		echo mysql_errno() . " : " . mysql_error();
	}
	
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="keywords"
	content="admin, dashboard, bootstrap, template, flat, modern, theme, responsive, fluid, retina, backend, html5, css, css3">
<meta name="description" content="">
<meta name="author" content="ThemeBucket">
<link rel="shortcut icon" href="#" type="image/png">

<title>Alerts</title>

<!--icheck-->
<link href="js/iCheck/skins/minimal/minimal.css" rel="stylesheet">
<link href="js/iCheck/skins/square/square.css" rel="stylesheet">
<link href="js/iCheck/skins/square/red.css" rel="stylesheet">
<link href="js/iCheck/skins/square/blue.css" rel="stylesheet">

<!--dashboard calendar-->
<link href="css/clndr.css" rel="stylesheet">


<!--common-->
<link href="css/style.css" rel="stylesheet">
<link href="css/style-responsive.css" rel="stylesheet">




<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
  <script src="js/html5shiv.js"></script>
  <script src="js/respond.min.js"></script>
  <![endif]-->
</head>

<body class="sticky-header">

	<section>
		<!-- left side start-->
		<div class="left-side sticky-left-side">

			<!--logo and iconic logo start-->
			<?php include("include/add-logo.php"); ?>
			<!--logo and iconic logo end-->

			<div class="left-side-inner">

				<!-- visible to small devices only -->
				<div class="visible-xs hidden-sm hidden-md hidden-lg">
					<div class="media logged-user">
						
					</div>

					<h5 class="left-nav-title">Account Information</h5>
					<ul class="nav nav-pills nav-stacked custom-nav">
						<li><a href="EditProfile.php"><i class="fa fa-user"></i> <span>Profile</span></a></li>
						<li><a href="changePassword.php"><i class="fa fa-cog"></i> <span>Settings</span></a></li>
						<li><a href="SignOut.php"><i class="fa fa-sign-out"></i> <span>SignOut</span></a></li>
					</ul>
				</div>

				<?php
					include("include/sideNav.php");
				?>
				

			</div>
		</div>
		<!-- left side end-->

		<!-- main content start-->
		
		<div class="main-content">

			<!-- header section start-->
			<div class="header-section">

				<!--toggle button start-->
				<a class="toggle-btn"><i class="fa fa-bars"></i></a>
				<!--toggle button end-->

				<!--search start-->
				<!-- <form class="searchform" action="index.html" method="post">
					<input type="text" class="form-control" name="keyword"
						placeholder="Search here..." />
				</form> -->
				<!--search end-->

				<!--notification menu start -->
				<div class="menu-right">
					<ul class="notification-menu">
						
						
						
							
						<li><a href="#" class="btn btn-default dropdown-toggle"
							data-toggle="dropdown"> Admin <span
								class="caret"></span>
						</a>
							<ul class="dropdown-menu dropdown-menu-usermenu pull-right">
								<li><a href="EditProfile.php"><i class="fa fa-user"></i> Profile</a></li>
								<li><a href="changePassword.php"><i class="fa fa-cog"></i> Settings</a></li>
								<li><a href="SignOut.php" data-toggle="model" data-target="#mymodel"><i
										class="fa fa-sign-out"></i> Log Out</a></li>
							</ul>
						</li>

					</ul>
				</div>
				<!--notification menu end -->

			</div>
			<!-- header section end-->


        <!--body wrapper start-->
        <div class="wrapper">
            	<div class="row mt">
						<div class="col-lg-12">
							
							<?php
								if($success != "")
								{
									echo "<div class='alert alert-success alert-dismissable'>
								  <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
								  <strong>SUCESS!&nbsp;&nbsp;&nbsp; </strong> $success</div>";
								}
								if($failure != "")
								{
									echo "<div class='alert alert-danger alert-dismissable'>
								  <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
								  <strong>Warning!&nbsp;&nbsp;&nbsp; </strong>$failure</div>";
								}
							?>
						
						<div class = "panel panel-primary">
							<div class="panel-heading">Users</div>
								<div class = "panel-body">
									
									<form role="form" action="insertNewBill.php" method="post">
										
											<div class = "row">
												<div class = "col-md-9">
													<div class="form-group">
														<a class="btn btn-primary" href="AddUser.php">Add User</a>
														<span class="alert-danger"></span>
													</div>		
												</div>	
												<div class = "col-md-3">
													<div class="form-group">
														
													</div>		
												</div>													
											</div>		
														
											<form>
												<div class="table-responsive">
													<table class="table table-striped table-bordered table-hover" id="bill_table">
													
														<thead>
															<tr>
																<th><span style="color:black;">Login Id</span></th>
																<th><span style="color:black;">Category</span></th>
																<th><span style="color:black;">Name</span></th>
															</tr>									
														</thead>
														<tbody>
														<?php
															while($row = mysql_fetch_array($recordSet))
															{
																$dbHintQuestion = $row["hintquestion"];
																$dbName = $row["name"];
																$dbCategory = $row["category"];
																$dbLoginId = $row["loginid"];
																if($dbCategory == "")
																{
																	$dbCategory = "Admin";
																}
																	echo "<tr>";
																		echo "<td>$dbLoginId</td>";
																		echo "<td style='text-align:left;'>$dbCategory</td>";
																		echo "<td style='text-align:left;'>$dbName</td>";
																		
																	echo "</tr>";
															}
															
														?>
														</tbody>
													</table>
												</div>
											</form>
										
										</div>
									</div>	
								</div>
							
						</div> 
					</div>
        </div>
        <!--body wrapper end-->

        <!--footer section start-->
        <!--footer>
            2014 &copy; AdminEx by ThemeBucket
        </footer>
        <!--footer section end-->


    </div>
    <!-- main content end-->
</section>

<!-- Placed js at the end of the document so the pages load faster -->
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="js/jquery-migrate-1.2.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/modernizr.min.js"></script>
<script src="js/jquery.nicescroll.js"></script>

<!--easy pie chart-->
<script src="js/easypiechart/jquery.easypiechart.js"></script>
<script src="js/easypiechart/easypiechart-init.js"></script>

<!--Sparkline Chart-->
<script src="js/sparkline/jquery.sparkline.js"></script>
<script src="js/sparkline/sparkline-init.js"></script>

<!--icheck -->
<script src="js/iCheck/jquery.icheck.js"></script>
<script src="js/icheck-init.js"></script>

<!-- jQuery Flot Chart-->
<script src="js/flot-chart/jquery.flot.js"></script>
<script src="js/flot-chart/jquery.flot.tooltip.js"></script>
<script src="js/flot-chart/jquery.flot.resize.js"></script>
<script src="js/flot-chart/jquery.flot.pie.resize.js"></script>
<script src="js/flot-chart/jquery.flot.selection.js"></script>
<script src="js/flot-chart/jquery.flot.stack.js"></script>
<script src="js/flot-chart/jquery.flot.time.js"></script>
<script src="js/main-chart.js"></script>

<!--common scripts for all pages-->
<script src="js/scripts.js"></script>

<script type = "text/javascript">
	$(function(){
	$('select.styled').customSelect();
	});
</script>
</body>
</html>
