Estou precisando da ajuda de vocês novamente...
Seguinte, eu consigo mostrar na tela as imagens para que o usuario escolha qual excluir porem quando ele clica no link de excluir, que é um X a pagina fica em branco. E a URL muda para http://www.meusite.c...letar.php?foto=
Ja mudei muitas vezes o código e nada...
Estou postando os códigos.
Listar
-------------------------------------------------------------------------------------------
<? include "config.php" ;
if (!isset($_SESSION)) {
session_start();
}
?>
<?php
$galeria = "SELECT * FROM brincos ORDER BY id DESC LIMIT 0,30 ";
$galeria = mysql_query($galeria) or die("Erro no SQL: ".mysql_error());
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
</head>
<body>
<strong>Clique no X para excluir: </strong><br><br>
<?php while ($array_galeria = mysql_fetch_array($galeria)) { ?>
<td>
<tr><a href="brincos/<? echo $array_galeria[foto];?>"><img src="brincos/<? echo $array_galeria[foto];?>" width="180" height="120"></a><a href="deletar.php?foto=<?php echo $row_cfoto_rs['foto']; ?>">X</a></tr>
</td>
<? } ?>
</body>
</html>Deletar
----------------------------------------------------------------------------------------------
<?php require('config.php');
?>
<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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($_SESSION['usuario_session'])) && ($_SESSION['usuario_session'] != "")) {
$deleteSQL = sprintf("DELETE FROM brincos WHERE Id=%s",
GetSQLValueString($_SESSION['usuario_session'], "text"));
mysql_select_db("dbteste3",$bd);
$Result1 = mysql_query($deleteSQL, $bd) or die(mysql_error());
$deleteGoTo = "listar.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
?>
<?php
$colname_cfoto_rs = "-1";
if (isset($_SESSION['usuario_session'])) {
$colname_cfoto_rs = (get_magic_quotes_gpc()) ? $_SESSION['usuario_session'] : addslashes($_SESSION['usuario_session']);
}
mysql_select_db("dbteste3",$bd);
$query_cfoto_rs = sprintf("SELECT * FROM brincos WHERE Id = '%s'", $colname_cfoto_rs);
$cfoto_rs = mysql_query($query_cfoto_rs, $bd) or die(mysql_error());
$row_cfoto_rs = mysql_fetch_assoc($cfoto_rs);
$totalRows_cfoto_rs = mysql_num_rows($cfoto_rs);
?><?php
$foto = $_GET['foto'];
unlink("brincos/$foto");
?>
<?php
mysql_free_result($cfoto_rs);
?>
Grata desde já!!











