first_php_project/admin/evento_deleta.php
2021-11-19 22:12:23 -03:00

50 lines
1.7 KiB
PHP
Executable File

<?php require_once('../Connections/conn_sustentabilidade.php'); ?>
<?php include('acesso.php')?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
if ((isset($_GET['id_evento'])) && ($_GET['id_evento'] != "")) {
$deleteSQL = sprintf("DELETE FROM tbeventos WHERE id_evento=%s",
GetSQLValueString($_GET['id_evento'], "int"));
mysql_select_db($database_conn_sustentabilidade, $conn_sustentabilidade);
$Result1 = mysql_query($deleteSQL, $conn_sustentabilidade) or die(mysql_error());
$deleteGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
?>