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

$chn=strtoupper($_GET['chn'] ?? '');

$xcyc = $_POST['cyc_no'] ?? '';
$rec_id = $_GET['actvty_id'] ?? '';
$ip=$_SERVER['REMOTE_ADDR'] ?? '';
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'] ?? '';
		$pat_id = strtoupper($_POST['pat_id'] ?? '');
		$cycle_no = $_POST['cycle_no'] ?? '';
		$strownos = $_POST['strownos'] ?? '';
		$act_duedt = $_POST['act_duedt'] ?? '';
		$extnd_duedt = $_POST['extnd_duedt'] ?? '';
		$contnrno = $_POST['contnrno'] ?? '';
		$canistrno = $_POST['canistrno'] ?? '';
		$goblet = $_POST['goblet'] ?? '';
		$cryocolor = $_POST['cryocolor'] ?? '';
		$act_rem = $_POST['act_rem'] ?? '';
		$result = mysqli_query($conn, "UPDATE actvty_trans_frzng_embryo 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_embryo (strow_no, due_date_act, pat_id, cycle_id, contnrno, canistrno, goblet, cryocolor, user_id)
        VALUES('$strownos','$extnd_duedt', '$pat_id', '$cycle_no', '$contnrno', '$canistrno', '$goblet', '$cryocolor', '$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";
}
?>