<?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'); ?>
<?php $user->MembersOnly(); ?>
<!-- <div id="content"> -->
<?php
if (($_SERVER['REQUEST_METHOD']!='POST'))
{
// Populate form with this reference
$ref_id = $_GET['id'];
$r = new ReferenceManager();
$html = $r->EditReferenceForm($ref_id);
echo $html;
}
else
{
// Store updated details in the database
// (called if user submits edit form), then
// redirect back to display form
$r = new Reference();
$r->Populate($_POST);
$r->Update();
$html = "<script language=\"JavaScript\">";
$html .= "alert(\"Reference has been updated in the database\");";
$html .= "document.location = 'bib_display_reference.php?id=";
$html .= $_POST['reference_id'];
$html .= "&format=report';";
$html .= "</script>";
echo $html;
}
?>
<!-- </div> -->
<?php include ('footer.inc.php'); ?>
</body>
</html>