<?php
session_start();                      
$username=$_SESSION['username'] ?? null;
$password=$_SESSION['password'] ?? null;
include 'dbcon.php';
$password=md5($password);
$sql = mysqli_query($conn, "SELECT * FROM matcher_usermst WHERE nif_usr='$username' AND nif_pass='$password' AND act_vate='1'");
$login_check = mysqli_num_rows($sql);
if($login_check > 0){
	$xchn = $_POST['chn'] ?? null;
	$xcycno = $_POST['cycno'] ?? null;
	$reasonclsng = $_POST['reasonclsng'] ?? null;
	$result = mysqli_query($conn, "UPDATE cycle_lst SET cycle_activt='1',x1allfz='1', x1noet='$reasonclsng' WHERE x1flag='$xcycno' limit 1");
     echo "<b>Record updated successfully!<br>You'll be redirected to patient list page now";
     echo "<meta http-equiv=Refresh content=2;url=gend_cycle_select.php?chn=$xchn>";
}else{
echo "User name or password not matched, try login again";
}
?>