<?php
session_start();                      
$username=$_SESSION['username'] ?? null;
$password=$_SESSION['password'] ?? null;
$chn=$_GET['chn'] ?? null;
$xcyc=$_GET['cyc_no'] ?? null;
$rec_id = $_GET['actvty_id'] ?? null;
$ip=$_SERVER['REMOTE_ADDR'] ?? 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){
		$log_no = $_POST['log_no'] ?? null;
		$pat_id = $_POST['chn'] ?? null;
		$cycle_no = $_POST['cycle_no'] ?? null;
		$strownos = $_POST['strownos'] ?? null;
		$act_duedt = $_POST['act_duedt'] ?? null;
		$extnd_duedt = $_POST['extnd_duedt'] ?? null;
		$contnrno = $_POST['contnrno'] ?? null;
		$canistrno = $_POST['canistrno'] ?? null;
		$liftno = $_POST['liftno'] ?? null;
		$vialposno = $_POST['vialposno'] ?? null;
		$act_rem = $_POST['act_rem'] ?? null;
		$result = mysqli_query($conn, "UPDATE actvty_trans_frzng_sperm SET due_date_comp=now(), remarks='$act_rem', actvty_mrk='e' WHERE log_no='$log_no' limit 1");
		$sql = mysqli_query($conn, "INSERT INTO actvty_trans_frzng_sperm (strow_no, due_date_act, pat_id, cycle_id, contnrno, canistrno, liftno, vialposno, user_id)
        VALUES('$strownos','$extnd_duedt', '$pat_id', '$cycle_no', '$contnrno', '$canistrno', '$liftno', '$vialposno', '$username')")
        or die (mysqli_error($conn));
        echo "<b>Freezing terms extended successfully!<br>You'll be redirected to main page now";
echo "<meta http-equiv=Refresh content=2;url=gend_cycle_select.php?chn=$pat_id>";
}else{
echo "User name or password not matched, try login again";
}
?>