Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá colegas ;D
Estou com um grande problema com um script para cadastro de imagens. Utilizei este mesmo em um projeto anterior, adaptado as minhas necessidades, que funcionava perfeitamente.
Mas, ao reutiliza-lo em um outro projeto, modificando somente as tabelas do banco e dados, ja não consegui obter o funcionamento.
fiz então alguns testes de escrita para saber até que variável ele estava recebendo os dados. Obtive resultado na tela até a variável $Destinob.
O banco de dados deste projeto não é muito diferente do anterior, então não sei o que pode estar ocorrendo.
Help me please? :D
processa_upload.php
<?
include "valida_cookies.php";
include "config.php";
$cat = $_POST['categoria'];
echo "Categoria : ".$cat."<br>"; //provisorio... mostrar a categoria que chega
$verifi_cat = mysql_query("SELECT * FROM $tfotos WHERE idcatfotos='$cat'");
$result = mysql_num_rows($verifi_cat);
if($result){
$del = mysql_query("DELETE FROM $tfotos WHERE idcatfotos='$cat'");
}
?><html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="css/estrutura.css" rel="stylesheet" type="text/css" />
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<style type="text/css"> background-color: #CAEAFF;
}</style>
</head>
<body>
<div id="fundo">
<div id="componentes">
<div id="titulo">
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="200">
<param name="movie" value="swf/topo_admin.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="swfversion" value="9.0.45.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="swf/topo_admin.swf" width="600" height="200">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="swfversion" value="9.0.45.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="[http://www.adobe.com/go/getflashplayer">-- Versão do Servidor: 5.0.67
-- Versão do PHP: 5.2.6
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Banco de Dados: tridez_julier
--
-- --------------------------------------------------------
--
-- Estrutura da tabela categorias
--
CREATE TABLE IF NOT EXISTS `categorias` (
`idcategoria` int(11) NOT NULL,
`categoria` char(100) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`idcategoria`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Extraindo dados da tabela categorias
--
INSERT INTO categorias (idcategoria, categoria) VALUES
(1, 'Casamentos'),
(2, 'Books'),
(3, '15 anos'),
(4, 'Publicidade');
-- --------------------------------------------------------
--
-- Estrutura da tabela fotos
--
CREATE TABLE IF NOT EXISTS `fotos` (
`idfoto` int(11) NOT NULL auto_increment,
`enderecoimg` varchar(200) collate utf8_unicode_ci NOT NULL,
`miniatura` varchar(200) collate utf8_unicode_ci NOT NULL,
`idcatfotos` int(11) NOT NULL,
PRIMARY KEY (`idfoto`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7 ;
--
-- Extraindo dados da tabela fotos
--
INSERT INTO `fotos` (`idfoto`, `enderecoimg`, `miniatura`, `idcatfotos`) VALUES
(6, 'fotos/DSC01021.JPG', '', 0);
-- --------------------------------------------------------
--
-- Estrutura da tabela servicos
--
CREATE TABLE IF NOT EXISTS `servicos` (
`idservico` int(11) NOT NULL auto_increment,
`servico` char(80) collate utf8_unicode_ci NOT NULL,
`imga` varchar(200) collate utf8_unicode_ci NOT NULL,
`imgb` varchar(200) collate utf8_unicode_ci NOT NULL,
`imgc` varchar(200) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`idservico`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
--
-- Extraindo dados da tabela servicos
--
-- --------------------------------------------------------
--
-- Estrutura da tabela usuarios
--
CREATE TABLE IF NOT EXISTS `usuarios` (
`idusuario` int(11) NOT NULL auto_increment,
`nome` varchar(100) collate utf8_unicode_ci NOT NULL,
`login` char(10) collate utf8_unicode_ci NOT NULL,
`senha` char(10) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`idusuario`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=12 ;
--
-- Extraindo dados da tabela usuarios
--
INSERT INTO usuarios (idusuario, nome, login, senha) VALUES
(4, 'bruna', 'bruna', '123'),
(6, 'Julier', 'julier', '321');
Se ficar duvidas. segue abaixo os formularios de cadastro
cadfotos.php
<? include "config.php"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="css/estrutura.css" rel="stylesheet" type="text/css" />
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<style type="text/css"> background-color: #CAEAFF;
}</style>
<script>
var requi;
function criaCampos(quantidade) {
var url = "quantidade=" + quantidade ;
//Verificar o Browser
if(window.XMLHttpRequest) {
requi = new XMLHttpRequest();
}
else if(window.ActiveXObject) {
requi = new ActiveXObject("Microsoft.XMLHTTP");
}
requi.open("POST", "geraCampos.php", true);
requi.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
requi.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
requi.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
requi.setRequestHeader("Pragma", "no-cache");
requi.setRequestHeader('Content-length', url.length );
requi.onreadystatechange = callbacki;
requi.send(url);
}
function callbacki() {
if(requi.readyState == 4) {
if(requi.status == 200) {
var respostai = requi.responseText;
document.getElementById('FormCampos').innerHTML = respostai;
}
}
}
function limpaForm() {//Limpeza dos campos do fomulário principal
document.getElementById('quantidade').value = '';
}
</script></head>
<body>
<div id="fundo">
<div id="componentes">
<div id="titulo">
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="200">
<param name="movie" value="swf/topo_admin.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="swfversion" value="9.0.45.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="swf/topo_admin.swf" width="600" height="200">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="swfversion" value="9.0.45.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="[http://www.adobe.com/go/getflashplayer"><?php
include "config.php";
$Quantidade = (isset($_POST['quantidade']) && is_int(intval($_POST['quantidade']))) ? (int)$_POST['quantidade'] : 0;
// Abre formulário de upload
echo '<b>Envio das fotos</b><br>';
// Imprime os campos para upload, de acordo com a quantidade pedida
for($i = 1; $i <= $Quantidade; ++$i)
{
echo 'Página ' . $i . ': <input type="file" name="fotos[]" /><br/>';
}
?>Carregando comentários...