<?php // $Id: iInsertBibref.php,v 1.1 2005/10/27 10:14:24 geothms Exp geothms $
session_start();
/*
 * BibRefs/iInsertBibref.php
 * 
 * Copyright 2009, 2018 Pedro Quaresma <pedro@mat.uc.pt>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

require_once('../servidor.php');

$pUtilizador = $_SESSION['utilizador'];
$pSenha = $_SESSION['senha'];
$pTipoUtilizador = $_SESSION['tipoUtilizador'];
if ($pTipoUtilizador=="anonymous" || $pTipoUtilizador=="regular") {// separa por tipo de utilizador
  require($entradaFILE.'headerUsers.php');
  require($entradaFILE.'menuUsers.php');
} 
else {
  require($entradaFILE.'headerAdmins.php');
  require($entradaFILE.'menuAdmins.php');
}

?>

<meta http-equiv="refresh" content="2; url=listingBibrefs.php" />

<center>
<h3 class="maketitle">Geometric theorems - Insert a Bib. Ref.</h3>
</center>

<hr/>



<?php
require($entradaFILE.'dbLogin.php');
?>

<?php

$pBibRefId    = $_POST['BibRefId'];
$pBibtexEntry = $_POST['BibtexEntry'];

// Formata os valores para posterior inserção na Tabela
if (!get_magic_quotes_gpc())
  { $pBibRefId    = addslashes('$pBibRefId');
    $pBibtexEntry = addslashes('$pBibtexEntry');
  }

$sqlInsertBibRef = 
     "INSERT INTO bibrefs
       (bibrefId,bibtexEntry)
      VALUES 
       ('$pBibRefId','$pBibtexEntry')";


$resultadoInsertBibRef = mysqli_query($ligacao,$sqlInsertBibRef);

if ($resultadoInsertBibRef) {
  echo 'New Bib. Ref. Inserted.'; 
 }
 else
   echo 'Error - Bib. Ref. not inserted!';
?>

<hr/>

<p>&nbsp;</p>

<?php
require($entradaFILE.'footer.php');
?>
