<?php session_start();?>

<?php
	if($_SESSION ["role"]=="Evaluator")
	{
		$role = $_SESSION["role"];
		$email = $_SESSION["email"];
		// header('location:form.php');
	}
	else
	{
		header('location:index.php?expired session please login back');
		// $userName = $_SESSION["userName"]; $userRole = $_SESSION["userRole"];
		}
?>
<?

require ("_common/global.php");
require ("_common/conn.php");
//require ("_common/function.php");
require ("_common/check_session.php");
  
//$idvac =$_REQUEST['idvac'];
//$name =$_REQUEST['name'];
$email =$_SESSION['email'];
	$conn = mysql_connect('localhost', 'dvsvigov_vacc', 'DVSvacdos123');
	 if (!$conn)
    {
	 die('Could not connect: ' . mysql_error());
	}
	mysql_select_db("dvsvigov_vacdos", $conn);
$result = mysql_query("SELECT * FROM user WHERE email='$email'");
$test = mysql_fetch_array($result);
if (!$result)
		{
		die("Error: Data not found..");
		}
				$Assess=$test['name'] ;
				
mysql_close($conn);

?>
 <?php
$idvac =$_REQUEST['idvac'];
//$name =$_REQUEST['name'];
//$email =$_SESSION['email'];
	$conn = mysql_connect('localhost', 'dvsvigov_vacc', 'DVSvacdos123');
	 if (!$conn)
    {
	 die('Could not connect: ' . mysql_error());
	}
	mysql_select_db("dvsvigov_vacdos", $conn);
$result = mysql_query("SELECT * FROM vacc WHERE idvac='$idvac'");
$test = mysql_fetch_array($result);
if (!$result)
		{
		die("Error: Data not found..");
		}
				$idvac=$test['idvac'] ;
				
mysql_close($conn);

?>
<?php

/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "dvsvigov_vacc", "DVSvacdos123", "dvsvigov_vacdos");
 
// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Escape user inputs for security
// $fName = mysqli_real_escape_string($link, $_POST['fName']);

$statusform = mysqli_real_escape_string ($link, $_POST['statusform']);
$datesubmit = mysqli_real_escape_string($link, $_POST['datesubmit']);

// attempt insert query execution
$sql = "UPDATE dossierform SET statusform = '$statusform', datesubmit = '$datesubmit' WHERE idvac='$idvac' AND Assess='$Assess'";
//$sql2 = "UPDATE vacc SET statusform = '$statusform' WHERE idvac='$idvac'";

mysqli_query($link, $sql);
//mysqli_query($link, $sql2);
//mysqli_query($link, $sql2);
//mysqli_query($link, $sql3);
header('location: list.php');
mysqli_close($link);
?>
