Location: PHPKode > projects > MyPHPBib > bib_pubmed_import_action.php
<?php

require_once ('login/user.inc.php');
$user->MembersOnly(); // this will check if user can access page, and bounce them if not
include ('phpbib/phpbib.inc.php');

?>

<?php include ('header.inc.php'); ?>

<body>

<?php include ('top.inc.php'); ?>

<!-- <div id="content"> -->

<?php
	if (($_SERVER['REQUEST_METHOD']!='POST'))
	{
		// Get PubMed reference
/*		$p = new Pubmed($_GET['PMID']);
		$xml = $p->Get();
		echo $xml;*/

		$r = new ReferenceManager();
		$html = $r->ImportPubMed($_GET['PMID']);
		echo $html;
		
	}
	else
	{
		// Store reference in the database 
		// (called if user submits edit form), then
		// redirect back to display form. If reference already
		// exists we alert the user, then display that reference.
		$r = new Reference();
		$r->Populate($_POST);
		
		$html = "<script language=\"JavaScript\">";
		$id = $r->InDatabase();
		if ($id != 0)
		{
			// We have this already
			$html .= "alert(\"Reference is already in the database\");";
		}
		else
		{
			$id = $r->Store();
			$html .= "alert(\"Reference has been added to the database\");";
		}
		$html .= "document.location = 'bib_display_reference.php?id=";
		$html .= $id;
		$html .= "&format=report';";
		
		$html .= "</script>";
		echo $html;
	}
?>


<!-- </div> -->

<?php include ('footer.inc.php'); ?>


</body>
</html>
Return current item: MyPHPBib