<?php
session_start();
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
 header("Location: index.php");
} 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PMS Member's Only</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300" rel="stylesheet" type="text/css" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/ecmascript">
function printdiv(printpage)
{
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
}

    function visitPage(){
        window.location='members2.php';
    }

</script>
 <script type = "text/javascript" >
    history.pushState(null, null, 'printall.php');
    window.addEventListener('popstate', function(event) {
    history.pushState(null, null, 'printall.php');
    });
</script>
<script type="text/javascript">
    function warning()
    {
        return "Please print the page before leaving"; //U can write any custom message here.
    }
    window.onbeforeunload = warning;
</script>
</head>
<body>
<div id="header" class="container">
	<div id="logo">
		<h1>PMS - Porter's Management System</h1>
	</div>
</div>

<div id="page" class="container">
	<div id="sidebar1">
		<div id="box1"><ul class="style1">
				<li class="first"><a href="select_porters.php" class="link-style">SELECT PORTERS</a></li>
				<li><a href="printall.php" class="link-style">Print All</a></li>
                               <li><a href="logout.php" class="link-style">Logout</a></li>
			</ul>
            </div>
	</div>

<table style="width:850px">
  <tr>
    <td align="center">
      <table border="1" style="width:820px">
      <tr>
      <td>S/N</td>
        <td>Account Number</td>
        <td>Full Name</td>
        <td>Phone Number</td>
		 <td>Status</td>

 </tr>
<?php
$con=mysqli_connect("localhost", "comeadve_glory1", "Safari#@2027$", "comeadve_tdmc");
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  
//$lmt=$_POST['NumberOfPorters'];	
	
$order = "SELECT * FROM employees";	
$result=mysqli_query($con,$order)
  or die("Sorry, The page has been reloaded and no data were selected from the database!");	  
$num_rows = mysqli_num_rows($result);
echo "$num_rows Porters Selected.\n";	

//if($lmt ==0){
	
//	echo "";
//	}
  
//else{
//   while(
   
while($data = mysqli_fetch_array($result)){
   echo("<tr><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td><td>$data[3]</td><td>$data[4]</td></tr>");
   }
   //update status;
   /*
   $sqlu = "UPDATE employees
        SET Status='1'
        WHERE (Status =0) ORDER BY Id LIMIT $lmt";
        mysqli_query($con,$sqlu);
   }
*/	
mysqli_close($con);
?>
</table>
</td>
</tr>
</table>
</table>
</td>
</tr>
</table>


	</div>
	<div class="print" align="center"><br /><br /><input name="b_print" type="button" class="ipt"   onClick="printdiv('content');" value="&nbsp;&nbsp;Print List & Save(pdf) file&nbsp;&nbsp;"> </div>
</div>
<div id="footer">
	<p>&copy; Trek DMC kilimanjaro. All rights reserved. Design by <a href="www.technohosttz.com">TDMC Kilimanjaro</a></p>
</div>
</body>
</html>
