Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
estou tentando cadastrar varias imagem em uma unica id, por exemplo escolho 5 fotos no campo file mais ele simplesmente só cadastra uma não deixa cadastrar mais que uma foto, eu sei que tem como fazer já cadastrei uma vez em um site mais não sei como fazer!
gostaria de uma orientação
agradeço desde já
e o código esta logo abaixo
<?php require_once('../Connections/imoveisclev.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
// Logout the current user.
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "../logar.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php// Load the tNG classes
require_once('../includes/tng/tNG.inc.php');
// Make a transaction dispatcher instance
$tNGs = new tNG_dispatcher("../");
// Make unified connection variable
$conn_imoveisclev = new KT_connection($imoveisclev, $database_imoveisclev);
// Start trigger
$formValidation = new tNG_FormValidation();
$tNGs->prepareValidation($formValidation);//start Trigger_ImageUpload trigger
//remove this line if you want to edit the code by hand
function Trigger_ImageUpload(&$tNG) {
$uploadObj = new tNG_ImageUpload($tNG);
$uploadObj->setFormFieldName("img");
$uploadObj->setDbFieldName("img");
$uploadObj->setFolder("../painel/IMG_IMV/");
$uploadObj->setMaxSize(15000);
$uploadObj->setAllowedExtensions("gif, jpg, jpe, jpeg, png");
$uploadObj->setRename("auto");
return $uploadObj->Execute();
}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;
}
}
mysql_select_db($database_imoveisclev, $imoveisclev);
$query_cat_imoveis = "SELECT * FROM categoria_imv ORDER BY catg ASC";
$cat_imoveis = mysql_query($query_cat_imoveis, $imoveisclev) or die(mysql_error());
$row_cat_imoveis = mysql_fetch_assoc($cat_imoveis);
$totalRows_cat_imoveis = mysql_num_rows($cat_imoveis);
// Make an insert transaction instance
$ins_imoveis = new tNG_insert($conn_imoveisclev);
$tNGs->addTransaction($ins_imoveis);$ins_imoveis->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
$ins_imoveis->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$ins_imoveis->registerTrigger("END", "Trigger_Default_Redirect", 99, "imoveis.php");
$ins_imoveis->registerTrigger("AFTER", "Trigger_ImageUpload", 97);$ins_imoveis->setTable("imoveis");
$ins_imoveis->addColumn("img", "FILE_TYPE", "FILES", "img");
$ins_imoveis->addColumn("nome", "STRING_TYPE", "POST", "nome");
$ins_imoveis->addColumn("categoria", "STRING_TYPE", "POST", "categoria");
$ins_imoveis->addColumn("tamanho", "STRING_TYPE", "POST", "tamanho");
$ins_imoveis->addColumn("cidade", "STRING_TYPE", "POST", "cidade");
$ins_imoveis->addColumn("uf", "STRING_TYPE", "POST", "uf");
$ins_imoveis->addColumn("pq_descri", "STRING_TYPE", "POST", "pq_descri");
$ins_imoveis->addColumn("grd_desci", "STRING_TYPE", "POST", "grd_desci");
$ins_imoveis->addColumn("data", "STRING_TYPE", "POST", "data");
$ins_imoveis->addColumn("usuario", "STRING_TYPE", "POST", "usuario");
$ins_imoveis->setPrimaryKey("id", "NUMERIC_TYPE");
// Execute all the registered transactions
$tNGs->executeTransactions();
// Get the transaction recordset
$rsimoveis = $tNGs->getRecordset("imoveis");
$row_rsimoveis = mysql_fetch_assoc($rsimoveis);
$totalRows_rsimoveis = mysql_num_rows($rsimoveis);
?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "../logar.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/painel.css" rel="stylesheet" type="text/css" />
<title>Painel Administrativo </title>
<style type="text/css">.txt_esquerdo {
text-align: left;
}</style>
<link href="../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<script src="../includes/common/js/base.js" type="text/javascript"></script>
<script src="../includes/common/js/utility.js" type="text/javascript"></script>
<script src="../includes/skins/style.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<?php echo $tNGs->displayValidationRules();?>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?PHP include('topopainel.php'); ?>
<table width="100%">
<tr>
<td width="83%" class="txt_esquerdo"><?PHP include('salda.php'); ?>
<?php $nomeuser = $_SESSION['MM_Username'];
echo $nomeuser; ?> Seja Bem Vindo !!!
</td>
<td width="17%"><h2><a href="<?php echo $logoutAction ?>">Sair Sistema</a></h2></td>
</tr>
</table>
<br />
<?php include('menu.php'); ?>
<div id="conteudo">
<?php
echo $tNGs->getErrorMsg();
?>
<form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>" enctype="multipart/form-data">
<table cellpadding="2" cellspacing="0" class="KT_tngtable">
<tr>
<td class="KT_th"><label for="img">Img:</label></td>
<td><input type="file" name="img" id="img" size="32" />
Upload <?php echo $tNGs->displayFieldError("imoveis", "img"); ?></td>
</tr>
<tr>
<td class="KT_th"><label for="nome">Nome:</label></td>
<td><span id="sprytextfield1">
<input type="text" name="nome" id="nome" value="<?php echo KT_escapeAttribute($row_rsimoveis['nome']); ?>" size="32" />
<span class="textfieldRequiredMsg">É necessário Digitar um caracter.</span></span><?php echo $tNGs->displayFieldHint("nome");?> <?php echo $tNGs->displayFieldError("imoveis", "nome"); ?></td>
</tr>
<tr>
<td class="KT_th"><label for="categoria">Categoria:</label></td>
<td><select name="categoria" id="categoria">
<?php?>
<option value="<?php echo $row_cat_imoveis['catg']?>"<?php if (!(strcmp($row_cat_imoveis['catg'], KT_escapeAttribute($row_rsimoveis['categoria'])))) {echo "selected=\"selected\"";} ?>><?php echo $row_cat_imoveis['nome_label']?></option>
<?php
} while ($row_cat_imoveis = mysql_fetch_assoc($cat_imoveis));
$rows = mysql_num_rows($cat_imoveis);
if($rows > 0) {
mysql_data_seek($cat_imoveis, 0);
$row_cat_imoveis = mysql_fetch_assoc($cat_imoveis);
}
?>
</select>
<?php echo $tNGs->displayFieldError("imoveis", "categoria"); ?></td>
</tr>
<tr>
<td class="KT_th"><label for="tamanho">Tamanho:</label></td>
<td><input type="text" name="tamanho" id="tamanho" value="<?php echo KT_escapeAttribute($row_rsimoveis['tamanho']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("tamanho");?> <?php echo $tNGs->displayFieldError("imoveis", "tamanho"); ?></td>
</tr>
<tr>
<td class="KT_th"><label for="cidade">Cidade:</label></td>
<td><input type="text" name="cidade" id="cidade" value="<?php echo KT_escapeAttribute($row_rsimoveis['cidade']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("cidade");?> <?php echo $tNGs->displayFieldError("imoveis", "cidade"); ?></td>
</tr>
<tr>
<td class="KT_th"><label for="uf">Uf:</label></td>
<td><input type="text" name="uf" id="uf" value="<?php echo KT_escapeAttribute($row_rsimoveis['uf']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("uf");?> <?php echo $tNGs->displayFieldError("imoveis", "uf"); ?></td>
</tr>
<tr>
<td class="KT_th"><label for="pq_descri">Pq_descri:</label></td>
<td><textarea name="pq_descri" id="pq_descri" cols="50" rows="5"><?php echo KT_escapeAttribute($row_rsimoveis['pq_descri']); ?></textarea>
<?php echo $tNGs->displayFieldHint("pq_descri");?> <?php echo $tNGs->displayFieldError("imoveis", "pq_descri"); ?></td>
</tr>
<tr>
<td class="KT_th"><label for="grd_desci">Grd_desci:</label></td>
<td><textarea name="grd_desci" id="grd_desci" cols="50" rows="5"><?php echo KT_escapeAttribute($row_rsimoveis['grd_desci']); ?></textarea>
<?php echo $tNGs->displayFieldHint("grd_desci");?> <?php echo $tNGs->displayFieldError("imoveis", "grd_desci"); ?></td>
</tr>
<tr>
<td class="KT_th"><label for="data">Data:</label></td>
<td><input type="text" name="data" id="data" value="<?php echo KT_escapeAttribute($row_rsimoveis['data']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("data");?> <?php echo $tNGs->displayFieldError("imoveis", "data"); ?></td>
</tr>
<tr>
<td class="KT_th"><label for="usuario">Usuario:</label></td>
<td><input type="text" name="usuario" id="usuario" value="<?php echo KT_escapeAttribute($row_rsimoveis['usuario']); ?>" size="32" />
<?php echo $tNGs->displayFieldHint("usuario");?> <?php echo $tNGs->displayFieldError("imoveis", "usuario"); ?></td>
</tr>
<tr class="KT_buttons">
<td colspan="2"><input type="submit" name="KT_Insert1" id="KT_Insert1" value="Cadastrar Imóveis" /></td>
</tr>
</table>
</form>
<p>
</p>
</div>
<p>
<!--div conteudo-->
</p>
<p> </p>
<?PHP include('rodape.php'); ?>
<script type="text/javascript"></script>
</body>
</html>
<?php
mysql_free_result($cat_imoveis);
?>Carregando comentários...