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

    if ( (!isset($_SESSION["login"]))or(!isset($_SESSION["pass"])) ) {
	    print "<strong>you need to <a href=\"login.php\">login</a> as an authorised curator to proceed.</strong>";
	    include ("frames_footer.php"); 
		return;
	}
	
	$motif=$_POST["motif"];

    $text = $_POST["text"];
    $text = ereg_replace( "'", "", $text);
	$text = stripslashes($text);

	if (strlen($text)==0)
	{
		print "<br><br><center><strong>Error: Empty value !</strong></center><br><br>";
		include ("frames_footer.php"); 
		return;
	}


	//Traitement pour la position
	$comments=$text;
	
	pg_query($c,"begin");
	
	$requete="update \"MOTIF_REGUL\" set \"COMMENTS\"='$comments' where \"MOTIF_ID\"='$motif'";


	pg_query($c,$requete) or die("<strong>Error</strong> ".pg_last_error($c));

	pg_query($c,"commit");

	echo '<SCRIPT LANGUAGE="JavaScript"> javascript:opener.location.reload(); self.close(); </script>';	    
	include ("frames_footer.php"); 		

	include ("frames_footer.php"); 

?>
