<?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']);
$Q7 = mysqli_real_escape_string($link, $_POST['Q7']);
$Q7comment = mysqli_real_escape_string($link, $_POST['Q7comment']);
$Q7AI = mysqli_real_escape_string($link, $_POST['Q7AI']);
$Q8 = mysqli_real_escape_string($link, $_POST['Q8']);
$Q8comment = mysqli_real_escape_string($link, $_POST['Q8comment']);
$Q8AI = mysqli_real_escape_string($link, $_POST['Q8AI']);
$Q9 = mysqli_real_escape_string($link, $_POST['Q9']);
$Q9comment = mysqli_real_escape_string($link, $_POST['Q9comment']);
$Q9AI = mysqli_real_escape_string($link, $_POST['Q9AI']);
$refQ7 = mysqli_real_escape_string($link, $_POST['refQ7']);
$refQ8 = mysqli_real_escape_string($link, $_POST['refQ8']);
$refQ9 = mysqli_real_escape_string($link, $_POST['refQ9']);

// attempt insert query execution
$sql = "UPDATE dossierform SET Q7 = '$Q7',Q7comment = '$Q7comment',Q7AI = '$Q7AI',Q8 = '$Q8', Q8comment = '$Q8comment',Q8AI = '$Q8AI',Q9 = '$Q9',Q9comment = '$Q9comment',Q9AI = '$Q9AI',refQ7 = '$refQ7',refQ8 = '$refQ8',refQ9 = '$refQ9' WHERE idvac='$idvac' AND Assess='$Assess'";
	
mysqli_query($link, $sql);

//mysqli_query($link, $sql3);


header('location: regime.php?idvac='.$idvac.'');
mysqli_close($link);
?>
