<?php
session_start();                      
$username=$_SESSION['username'] ?? '';
$password=$_SESSION['password'] ?? '';

$chn = $_POST['chn'] ?? '';
$cyc_no = $_POST['cyc_no'] ?? '';
$chnwcyc=$chn.".".$cyc_no;
$ip=$_SERVER['REMOTE_ADDR'] ?? '';
include 'dbcon.php';
$password=md5($password);
$sql = mysql_query("SELECT * FROM matcher_usermst WHERE nif_usr='$username' AND nif_pass='$password' AND act_vate='1'");

$login_check = mysql_num_rows($sql);
if($login_check > 0){
	$row = mysql_fetch_assoc($sql);
	$xadmnchk=$row['dept_x'];
    }
else {
	session_destroy();
echo ("<SCRIPT LANGUAGE='JavaScript'> window.location.href='invalidlogin.html'; </SCRIPT>");
}

?>
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<style type="text/css">
INPUT { margin-right: 1em }
</style>
<link href="../style.css" rel="stylesheet" type="text/css" />
<link href="style_btn.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js_button.js"></script>
<link href="../style_btn.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js_button.js"></script>
</head>
<body id="top">

			<section id="one" class="wrapper style1">
				<header class="major">
<h3>Matches for <?php echo $chn?></h3>
							<section>
<?php
//include 'dbcon.php';
echo $chnwcyc;
$result = mysql_query("SELECT * FROM matcher_tag_gen where chn_cycle like '%$chnwcyc%' and ( process_main_id='a1:b11' or process_main_id='a1:b12') order by ent_no asc");
echo "<table width=100% border='0' class='imagetable'> 
<tr>
<th width =auto align='left' bgcolor='#E0EFFC' style='text-align:left;font-size:18px;'>Tag generated</th> 
</tr>"; 
	while($row=mysql_fetch_array($result)) 
	{
		if($xadmnchk=="1"){
		$xdelnav="<a href='delrecy.php?cntr=$row[ent_no];'> [ Remove ]</a>";
		}else{
		}
		echo "<tr>"; 
						   if($row['process_main_id']=="a1:b11"){
						   $xprocedure="Thaw dish";
						   }elseif($row['process_main_id']=="a1:b12"){
						   $xprocedure="ET dish";
						   }else{
						   $xprocedure="System Glitch";
						   }

					$xentby=$row['ent_by'];

echo "<td width=100% style='text-align:left;font-size:18px;'>"."<font color='#009900'>".date('d/m/Y',strtotime($row['reslt_dt']))." ".substr($row['reslt_dt'],-8)." by user ".$xentby."</font>"." - "."<font color='$xclr'>".$xprocedure."</font>".$xdelnav."</td>";
}
?>
</section>
<A HREF="gend_cycle_select.php?chn=<?php echo $chn;?>" class="btn-two blue large">Back to patient page</A>
</header>
</section>
</body>
</html>
