<?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']);
//SPECIAL QUESTION DECLARE
$Q28=0;
$Q28comment=0;
$Q28AI=0;
$refQ28=0;
$Q29=0;
$Q29comment=0;
$Q29AI=0;
$refQ29=0;
$Q36=0;
$Q36comment=0;
$Q36AI=0;
$refQ36=0;

$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']);
//$Q28 = mysqli_real_escape_string($link, $_POST['Q28']);
if (isset($_POST['Q28'])) $Q28=$_POST['Q28'];
//$Q28comment = mysqli_real_escape_string($link, $_POST['Q28comment']);
if (isset($_POST['Q28comment'])) $Q28comment=$_POST['Q28comment']; 
//$Q28AI = mysqli_real_escape_string($link, $_POST['Q28AI']);
if (isset($_POST['Q28AI'])) $Q28AI=$_POST['Q28AI']; 
//$Q29 = mysqli_real_escape_string($link, $_POST['Q29']);    //this is to prevent the undefined index error due to no value coming in (special Question)
if (isset($_POST['Q29'])) $Q29=$_POST['Q29'];
//$Q29comment = mysqli_real_escape_string($link, $_POST['Q29comment']);
if (isset($_POST['Q29comment'])) $Q29comment=$_POST['Q29comment'];
//$Q29AI = mysqli_real_escape_string($link, $_POST['Q29AI']);
if (isset($_POST['Q29AI'])) $Q29AI=$_POST['Q29AI'];
$Q30 = mysqli_real_escape_string($link, $_POST['Q30']);
$Q30comment = mysqli_real_escape_string($link, $_POST['Q30comment']);
$Q30AI = mysqli_real_escape_string($link, $_POST['Q30AI']);
$Q31 = mysqli_real_escape_string($link, $_POST['Q31']);
$Q31comment = mysqli_real_escape_string($link, $_POST['Q31comment']);
$Q31AI = mysqli_real_escape_string($link, $_POST['Q31AI']);
$Q32 = mysqli_real_escape_string($link, $_POST['Q32']);
$Q32comment = mysqli_real_escape_string($link, $_POST['Q32comment']);
$Q32AI = mysqli_real_escape_string($link, $_POST['Q32AI']);
$Q33 = mysqli_real_escape_string($link, $_POST['Q33']);
$Q33comment = mysqli_real_escape_string($link, $_POST['Q33comment']);
$Q33AI = mysqli_real_escape_string($link, $_POST['Q33AI']);
$Q34 = mysqli_real_escape_string($link, $_POST['Q34']);
$Q34comment = mysqli_real_escape_string($link, $_POST['Q34comment']);
$Q34AI = mysqli_real_escape_string($link, $_POST['Q34AI']);
$Q35 = mysqli_real_escape_string($link, $_POST['Q35']);
$Q35comment = mysqli_real_escape_string($link, $_POST['Q35comment']);
$Q35AI = mysqli_real_escape_string($link, $_POST['Q35AI']);
//$Q36 = mysqli_real_escape_string($link, $_POST['Q36']);
if (isset($_POST['Q36'])) $Q36=$_POST['Q36'];
//$Q36comment = mysqli_real_escape_string($link, $_POST['Q36comment']);
if (isset($_POST['Q36comment'])) $Q36comment=$_POST['Q36comment'];
//$Q36AI = mysqli_real_escape_string($link, $_POST['Q36AI']);
if (isset($_POST['Q36AI'])) $Q36AI=$_POST['Q36AI'];
//$refQ28 = mysqli_real_escape_string($link, $_POST['refQ28']);
if (isset($_POST['refQ28'])) $refQ28=$_POST['refQ28']; 
//$refQ29 = mysqli_real_escape_string($link, $_POST['refQ29']);
if (isset($_POST['refQ29'])) $refQ29=$_POST['refQ29'];
$refQ30 = mysqli_real_escape_string($link, $_POST['refQ30']);
$refQ31 = mysqli_real_escape_string($link, $_POST['refQ31']);
$refQ32 = mysqli_real_escape_string($link, $_POST['refQ32']);
$refQ33 = mysqli_real_escape_string($link, $_POST['refQ33']);
$refQ34 = mysqli_real_escape_string($link, $_POST['refQ34']);
$refQ35 = mysqli_real_escape_string($link, $_POST['refQ35']);
//$refQ36 = mysqli_real_escape_string($link, $_POST['refQ36']);
if (isset($_POST['refQ36'])) $refQ36=$_POST['refQ36'];

// attempt insert query execution
$sql = "UPDATE dossierform SET Q28 = '$Q28',Q28comment = '$Q28comment',Q28AI = '$Q28AI',Q29 = '$Q29',Q29comment = '$Q29comment',Q29AI = '$Q29AI',Q30 = '$Q30',Q30comment = '$Q30comment',Q30AI = '$Q30AI',Q31 = '$Q31',Q31comment = '$Q31comment',Q31AI = '$Q31AI',Q32 = '$Q32',Q32comment = '$Q32comment',Q32AI = '$Q32AI',Q33 = '$Q33',Q33comment = '$Q33comment',Q33AI = '$Q33AI',Q34 = '$Q34',Q34comment = '$Q34comment',Q34AI = '$Q34AI',Q35 = '$Q35',Q35comment = '$Q35comment',Q35AI = '$Q35AI',Q36 = '$Q36',Q36comment = '$Q36comment',Q36AI = '$Q36AI',refQ28 = '$refQ28',refQ29 = '$refQ29',refQ30 = '$refQ30',refQ31 = '$refQ31',refQ32 = '$refQ32',refQ33 = '$refQ33',refQ34 = '$refQ34',refQ35 = '$refQ35',refQ36 = '$refQ36' WHERE idvac='$idvac' AND Assess='$Assess'";
	
mysqli_query($link, $sql);

//mysqli_query($link, $sql3);

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