<?php 
session_start();

/*
 * Scrapbook/deleteFromScrapbook.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');
$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');
}

// coloca o valor para a página de ajuda apropriada
$_SESSION['helpsection']='interaction';

require_once($entradaFILE.'dbLogin.php');

?>

<?php
require_once("functionsScrapbook.php");

$URL = addslashes($_SERVER['HTTP_REFERER']);

$pCodeTmpIdName = $_POST['CodeTmpIdName'];

preg_match("§([0-9]+) - ([A-Za-z0-9 _.]+)§",$pCodeTmpIdName,$matches);

$pCodeTmpId = $matches[1];

scrapbook_delete($pCodeTmpId,$ligacao);

echo "<meta http-equiv='refresh' content='2; url=\"$URL\"' />";

?>

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