<?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");
?>
<?php

	$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
/* 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']);
$idvac = mysqli_real_escape_string ($link, $_POST['idvac']);
//$vacctype = mysqli_real_escape_string ($link, $_POST['vacctype']);
$Assess = mysqli_real_escape_string($link, $_POST['Assess']);
//$datesubmit = mysqli_real_escape_string($link, $_POST['datesubmit']);
$Q1 = mysqli_real_escape_string($link, $_POST['Q1']);
$Q1comment = mysqli_real_escape_string($link, $_POST['Q1comment']);
$Q1AI = mysqli_real_escape_string($link, $_POST['Q1AI']);
$Q2 = mysqli_real_escape_string($link, $_POST['Q2']);
$Q2comment = mysqli_real_escape_string($link, $_POST['Q2comment']);
$Q2AI = mysqli_real_escape_string($link, $_POST['Q2AI']);
$Q3 = mysqli_real_escape_string($link, $_POST['Q3']);
$Q3comment = mysqli_real_escape_string($link, $_POST['Q3comment']);
$Q3AI = mysqli_real_escape_string($link, $_POST['Q3AI']);
$refQ1 = mysqli_real_escape_string($link, $_POST['refQ1']);
$refQ2 = mysqli_real_escape_string($link, $_POST['refQ2']);
$refQ3 = mysqli_real_escape_string($link, $_POST['refQ3']);

// attempt insert query execution
$sql = "UPDATE dossierform SET Q1 = '$Q1',Q1comment = '$Q1comment',Q1AI = '$Q1AI',Q2 = '$Q2', Q2comment = '$Q2comment',Q2AI = '$Q2AI',Q3 = '$Q3',Q3comment = '$Q3comment',Q3AI = '$Q3AI',refQ1 = '$refQ1',refQ2 = '$refQ2',refQ3 = '$refQ3' WHERE idvac='$idvac' AND Assess='$Assess'";
 

	
mysqli_query($link, $sql);

//mysqli_query($link, $sql3);
header('location: license.php?idvac='.$idvac.'');
mysqli_close($link);
?>
