<?php
	//include("connection.php");    
	session_start();
	include("frames_header.php");
	include("../constant.php");
?>

<center><strong>
<?php
	if( (strlen($_POST["login"])>1)and(strlen($_POST["pass"])>1) ){
		$c = pg_connect("host=$hostAniseed dbname=$dbnameAniseed user=".$_POST["login"]." password=".$_POST["pass"]."") or die("Couldn't Connect ".pg_last_error());
		$requete="SELECT \"AUTHOR_ID\", \"NAME\", \"SURNAME\" FROM \"AUTHOR\" WHERE \"LOGIN\" = '".$_POST["login"]."' and \"IS_CURATOR\"='y'";

		$stmt = pg_query($c,$requete);
		if($row=pg_fetch_array($stmt)){
			print "Connection granted.<br>Welcome ".$row["SURNAME"]." ".$row["NAME"].".";
		    
			
			$_SESSION['login'] = $_POST["login"];
		    $_SESSION['pass'] = $_POST["pass"];
			$_SESSION['curationauthor'] = $row["AUTHOR_ID"];
		
		}else{
		    print "Invalid login or password. <br>Only curators can access this web site.";
			
		    $_SESSION['login'] = $userAniseed;
		    $_SESSION['pass'] = $passwordAniseed;
			$_SESSION['curationauthor'] = "";
		}

		
	}else{
	    print "Enter a valid login and password.";
	}
    
?>
</strong></center>

<?php
    include("frames_footer.php");
?>
