<?php
	require_once '../../autoload.php';
	
	RightsCheck ("VIEW_EXAMLINK");

	$exam_id		 		= -1;
	$examident_id	 		= -1;
		
	
	if ( isset ( $_REQUEST['exam_id'] ) 		)	$exam_id		= $_REQUEST['exam_id'];
	if ( isset ( $_REQUEST['examident_id'] )	)	$examident_id	= $_REQUEST['examident_id'];
				
	$conn = get_dbconnection();
	
	$response = -1;
	
	if ( $conn )
	{
		$sql = '';

		$sql = 'insert into examident_link ( exam_id, examident_id ) values ('.$exam_id.','.$examident_id.');';
		
		$result = pg_query ( $conn, $sql );
		
		if ( $result )
		{
			$response = 1;
		}
	}
	
	header ('Content-type: text/xml' );
	
	echo $response;
?>