
Enviado em 18/01/2014 - 15:08h
Olá galerinha, beleza? Então, preciso de uma ajuda com um script.
<? include("../config.php");
include("verifica.php");
$acao = strip_tags( $_GET['acao'] );
?>
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Sistema de Administração de Imóves</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css.css" rel="stylesheet" type="text/css" />
<script src="../js/mascara.js" type="text/javascript"></script>
<script src="../js/mascara_moeda.js" type="text/javascript"></script>
<script src="ajax_combo.js" type="text/javascript"></script>
<script src="js/nicEdit.js" type="text/javascript"></script>
<script type="text/javascript">
//bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
bkLib.onDomLoaded(function() {
new nicEditor({fullPanel : true}).panelInstance('msg');
$msg = utf8_encode(utf8_decode($_POST["msg"]));
});
</script>
<style>
label{
display:block;
color:#006699;
padding-top:15px;
font-family:Arial, Helvetica, sans-serif;
}
label span{color:#666;font-size:11px;}
#content input, #content select{width:565px;}
</style>
</head>
<body>
<table width="1004" border="0" align="center" cellpadding="0" cellspacing="0" class="borda">
<!--DWLayoutTable-->
<tr>
<td height="57" colspan="3" valign="top" class="borda2"><img src="imagens/img-topo-adm.jpg"></td>
</tr>
<tr>
<td width="200" rowspan="6" valign="top" class="borda_menu">
<?php include_once('menu.php'); ?>
</td>
</tr>
<tr>
<td colspan="4" valign="top">
<!-- desenvolvido por estagio 7 - www.estagio7.com.br-->
<div id="content" style="margin-left:10px;">
<span class="titulos-adm">» Imóveis » Adicionar</span>
<?php if( empty( $acao ) ) { ?>
<form name="add" action="imoveis_add.php?acao=add" method="post" enctype="multipart/form-data">
<label>Código <span>(referencia do imóvel, se não houver deixe em branco)</span></label>
<input type="text" name="codigo" />
<label>Tipo de negocio *</label>
<select name="id_negocio_tipo">
<option value="">Selecione</option>
<?php
$sql = mysql_query("SELECT id, tipo FROM negocio_tipo ORDER BY tipo ASC");
while( $linha = mysql_fetch_array( $sql ) ){
echo '<option value="' . $linha['id'] . ' ">' . $linha['tipo'] . '</option>';
}
?>
</select>
<label>Tipo de imóvel *</label>
<select name="id_tipo_imovel">
<option value="">Selecione</option>
<?php
$sql = mysql_query("SELECT id, tipo_nome FROM imoveis_tipo ORDER BY tipo_nome ASC");
while( $linha = mysql_fetch_array( $sql ) ){
echo '<option value="' . $linha['id'] . '"> ' . $linha['tipo_nome'] . '</option>';
}
?>
</select>
<label>Cidade *</label>
<select name="id_cidade" onChange="Dados(this.value);">
<option value="">Selecione</option>
<?php
$sql = mysql_query("SELECT id, cidade, uf FROM cidades ORDER BY cidade ASC");
while( $linha = mysql_fetch_array( $sql ) ){
echo '<option value="' . $linha['id'] . '">' . $linha['cidade'] .' / '.$linha['uf'].'</option>';
}
?>
</select>
<label>Bairro *</label>
<select name="bairro" id="bairro" disabled="disabled">
<option value="" id="opcoes">Selecione a cidade</option>
</select>
<label>Endereço *</label>
<input type="text" name="end" />
<br /><br /><hr width="750" size="1" color="#006699"/>
<label>Quartos *</label>
<input type="text" name="quartos" onKeyPress="mascara(this,Numero)" />
<label>Suites *</label>
<input type="text" name="suites" onKeyPress="mascara(this,Numero)" />
<label>Dormitórios *</label>
<input type="text" name="dormitorios" onKeyPress="mascara(this,Numero)" />
<label>Banheiros *</label>
<input type="text" name="banheiros" onKeyPress="mascara(this,Numero)" />
<label>Garagem *</label>
<input type="text" name="garagem" onKeyPress="mascara(this,Numero)" />
<label>Area construida <span>(em m<sup>2</sup>)</span></label>
<input type="text" name="area_construida" />
<label>Area total <span>(em m<sup>2</sup>)</span> *</label>
<input type="text" name="area_total" />
<label>Terreno <span>(em m<sup>2</sup>)</span></label>
<input type="text" name="terreno" />
<label>Largura <span>(em m)</span> *</label>
<input type="text" name="largura" />
<label>Comprimento <span>(em m)</span> *</label>
<input type="text" name="comprimento" />
<br /><br /><hr width="750" size="1" color="#006699"/>
<label>Valor IPTU <span></span></label>
<input type="text" name="valor_iptu" onKeyPress="reais(this,event)" onKeyDown="backspace(this,event)" />
<label>Valor condomínio</label>
<input type="text" name="valor_condominio" onKeyPress="reais(this,event)" onKeyDown="backspace(this,event)" />
<label>Valor do imóvel * <span>Será exibido "consulte-nos" se não for informado valor</span></label>
<input type="text" name="valor" onKeyPress="reais(this,event)" onKeyDown="backspace(this,event)" />
<br /><br /><hr size="1" color="#006699" />
<label>Mostrar no site *</label>
<select name="ativo">
<option value="1">Sim</option>
<option value="0">Não</option>
</select>
<label>Imagem principal *</label>
<input name="foto" id="foto" type="file" /><br />
<label><b>Titulo</b> da imagem principal <span>Será exibido quando o imóvel estiver em destaque</span></label>
<input type="text" name="foto_titulo" /><br />
<label><b>Descrição</b> da imagem principal <span>Será exibido quando o imóvel estiver em destaque</span></label>
<input type="text" name="foto_descricao" /><br />
<br /><hr size="1" color="#006699" />
<label>Descrição do imóvel *</label>
<textarea name="msg" id="msg" cols="65" rows="5"></textarea><br />
<label>Proximidades</label>
<textarea name="proximidades" id="proximidades" cols="65" rows="5"></textarea><br />
<label>Código do GOOGLE MAPS</label>
<textarea name="mapa" id="mapa" cols="65" rows="5"></textarea><br /><br />
<input type="submit" name="submit" value="CADASTRAR IMÓVEL" style="width:150px;" />
</form>
<?php
} // fim da ação EMPTY
if( $acao == 'add')
{
extract( $_POST, EXTR_OVERWRITE); // extrai os dados do POST, transformando os indices em nomes. Sobrescreve as variaveis existentes, se houver
$sql1 = mysql_query("SELECT id FROM imoveis WHERE codigo='$codigo'");
$ttlCodigo = mysql_num_rows($sql1);
if( !empty( $codigo ) && $ttlCodigo > 0){
echo "<script language='JavaScript'>
alert('Código duplicado, informe outro código');
window.location.href='javascript:history.go(-1)'
</script>";
exit;
}
///////////////// TRATA A IMAGEM
$arquivo = isset($_FILES["foto"]) ? $_FILES["foto"] : FALSE;
if( !empty( $arquivo['name'] ) ) {
if(!eregi("^image\/(pjpeg|jpeg|gif)$", $arquivo["type"])){
echo "<script language='JavaScript'>
alert('Arquivo em formato inválido! Formato aceito: JPG, JPEG e GIF');
window.location.href='javascript:history.go(-1)'
</script>";
exit;
}
// Verifica tamanho do arquivo
if($arquivo["size"] > 2020680)
{
echo "<script language='JavaScript'>
alert('A imagem deve ser de no máximo 2020680 bytes');
window.location.href='javascript:history.go(-1)'
</script>";
exit;
}
// Para verificar as dimensões da imagem
$tamanhos = getimagesize($arquivo["tmp_name"]);
if($tamanhos[0] > 2000 || $tamanhos[0] < 200 || $tamanhos[1] > 2000 || $tamanhos[1] < 200 )
{
echo "<script language='JavaScript'>
alert('A dimensão da imagem não é permitido, tamanhao aceito: de 200 a 2000 pixels');
window.location.href='javascript:history.go(-1)'
</script>";
exit;
}
preg_match("/\.(gif|bmp|png|jpg|jpeg|swf){1}$/i", $arquivo["name"], $ext);
$imagem_nome = md5(uniqid(time())) . "." . $ext[1];
$imagem_nome2 = md5(uniqid(time())) . "_gr." . $ext[1];
$imagem_dir = "../img_imoveis/" . $imagem_nome;
include("resizer_img.php");
}
//////////////// FIM DA IMAGEM
$data = date( "d/m/Y" );
$hora = date( "H:i:s" );
$valor = str_replace('.', '', $valor);
$valor = str_replace(',', '.', $valor);
$sql = mysql_query("INSERT INTO imoveis (id_cidade, id_tipo_imovel, id_negocio_tipo, end, bairro, quartos, dormitorios, intima, suites, banheiros, garagem, codigo, foto_exibicao, foto_grande, area_construida, area_total, valor, valor_iptu, valor_condominio, msg, hora, data, destaque, ativo, mapa, foto_titulo, foto_descricao, proximidades, largura, comprimento, terreno, visualizacoes, AreaValue) VALUES ('$id_cidade', '$id_tipo_imovel', '$id_negocio_tipo', '$end', '$bairro', '$quartos', '$dormitorios', 'Íntima', '$suites', '$banheiros', '$garagem', '$codigo', '$imagem_nome', '$imagem_nome2', '$area_construida', '$area_total', '$valor', '$valo_iptu', '$valor_condominio', '$msg', '$data', '$hora', '$ativo', '$mapa', '$foto_titulo', '$foto_descricao', '$proximidades', '$largura', '$comprimento', '$terreno', '$visualizacoes', 'Área')") or print(mysql_error());
$ultimo_id = mysql_insert_id();
echo '<center>Imóvel cadastrado com sucesso<br /><br />
<p><a href="album_add.php?id='.$ultimo_id.'" target="_blank"><span style=font-size:12px; font-family:arial; font-weight:bold; color: #0033CC>GERENCIAR FOTOS</span></a></p>
<p><a href="imoveis_add.php">font-size:12px; font-family:arial; font-weight:bold; color: #0033CC ;CADASTRAR NOVO IMÓVEL</span></a></p><br><br><a href=imoveis.php>clique aqui para voltar</a></center>';
}
?>
<!-- fim conteúdo -->
</div>
</td>
</tr>
</table>
</body>
</html>
<label>Dormitórios *</label>
<input type="text" name="dormitorios" onKeyPress="mascara(this,Numero)" />
Papagaiando o XFCE com temas e recursos
WhatsApp com Chamadas no Linux via Waydroid
XFCE - quase um Gnome ou Plasma mas muito mais leve
LXQT - funcional para máquinas pererecas e usuários menos exigentes
Instalando o COSMIC DE no Gentoo (systemd)
Centralizar Logo com Transparência via ImageMagick
Removendo entradas de boot UEFI "fantasmas" via terminal
Atualizações de Segurança Automáticas no Debian
Como cortar as partes de um vídeo com passagens de áudio em branco
Midia de instalação LM-21.3 não inicializa [RESOLVIDO] (15)
What are the biggest challenges banks face with compliance training? (0)
Reunir material [RESOLVIDO] (4)
Uma pergunta bem simples mas não achei resposta (ainda) [RESOLVIDO] (4)









