-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
325 lines (279 loc) · 16 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<?php
session_start();
include 'conexao.php';
?>
<html>
<head>
<title> J & J Imobiliárias</title>
<meta charset="UTF-8">
<!-- ICONE LOGO -->
<link rel="icon" href="IMGS/icone%20(2).png"/>
<!-- CSS -->
<link href="IMGS/EstiloSite.css" rel="stylesheet" type="text/css"/>
<!-- BOTSTRAP -->
<link href="bootstrap-4.0.0/js/dist/carousel.js" rel="stylesheet">
<link href="bootstrap-4.0.0/dist/css/bootstrap-grid.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<!-- ICONS -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
<!-- SCRIPT -->
<script src="Script/JavaScript.js" type="text/javascript"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.10/jquery.mask.js"></script>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
</head>
<body>
<nav id="topo">
<nav id="links-menu">
<a href="index.php" id="imglogo"><img src="IMGS/icone%20(2).png" width="53px" style="margin-left: 20px; "></a>
<!--FAVORITOS-->
<div id="favHover">
<h4 id="fav" class="fas fa-heart">Favoritos</h4>
<div class="dropdown-content1">
<?php
if((!isset ($_SESSION['login']) == true) and (!isset ($_SESSION['senha']) == true)){
echo"Você precisa estar logado para favoritar";
} else {
$logado = $_SESSION['login'];
$selectFav = "SELECT i.idIMOVEL, b.NomeBairro, t.NomeTipo, concat('R$ ', i.Preco) as Preco
FROM fav_imoveis f
LEFT JOIN usuario u ON f.FKUsuario = u.idUSUARIO
LEFT JOIN imovel i ON f.FKImovel = i.idIMOVEL
LEFT JOIN tipo t ON t.idTIPO = i.FKTipo
LEFT JOIN bairro b ON b.idBAIRRO = i.FKBairro
WHERE u.login = '$logado'
ORDER BY f.dt_log ASC;";
$resultFav = mysqli_query($conexao, $selectFav);
$numRow = mysqli_num_rows($resultFav);
if ($numRow != 0) {
while($rows = mysqli_fetch_object($resultFav)) {
$historicoF[] = "<form method='POST' action='imovel.php'>
<div id='Favoritos'>
<h5 style='margin-top:20px; font-size:18; font-family: italic'>".$rows->NomeBairro."</h5>
<h6>".$rows->NomeTipo." - ".$rows->Preco."</h6>
<button id='btnfav2' value='$rows->idIMOVEL' name='idIMOVEL'>Ver mais</button>
<hr>
</div></form>";
}
if ($numRow==1)
$historicoF[] = 'Exibindo seu último favorito:<br>';
else
$historicoF[] = 'Exibindo seus '.(($numRow<3) ? $numRow : '3').' últimos favoritos:<br>';
}
if (isset($historicoF) && !empty($historicoF)) {
$countLimit = -1;
if (count($historicoF)<4)
$count = count($historicoF)-1;
else if (count($historicoF)==4)
$count = 3;
else {
$count = count($historicoF)-1;
$countLimit = count($historicoF)-5;
}
for ($i=$count; $i>$countLimit; $i--)
echo $historicoF[$i];
} else
echo "Sem Favoritos, favorite um imóvel";
}
?>
</div>
</div>
<!--HISTÓRICO -->
<div id="Favhover2">
<h4 id="hist" class="fas fa-history">Histórico</h4>
<div class="dropdown-content">
<?php
if((!isset ($_SESSION['login']) == true) and (!isset ($_SESSION['senha']) == true)){
echo"Você precisa estar logado para possuir um Historico.";
} else {
$logado = $_SESSION['login'];
$selectHist = "SELECT i.idIMOVEL, b.NomeBairro, t.NomeTipo, concat('R$ ', i.Preco) as Preco
FROM hist_imoveis f
LEFT JOIN usuario u ON f.FKUsuario = u.idUSUARIO
LEFT JOIN imovel i ON f.FKImovel = i.idIMOVEL
LEFT JOIN tipo t ON t.idTIPO = i.FKTipo
LEFT JOIN bairro b ON b.idBAIRRO = i.FKBairro
WHERE u.login = '$logado'
ORDER BY f.dt_log ASC;";
$resultFav = mysqli_query($conexao, $selectHist);
$numRow = mysqli_num_rows($resultFav);
if ($numRow != 0) {
while($rows = mysqli_fetch_object($resultFav)) {
$historico[] = "<form method='POST' action='imovel.php'>
<div id='Historico'>
<h5 style='margin-top:20px; font-size:18; font-family: italic'>".$rows->NomeBairro."</h5>
<h6>".$rows->NomeTipo." - ".$rows->Preco."</h6>
<button id='btnhist' value='$rows->idIMOVEL' name='idIMOVEL'>Ver mais</button>
<hr>
</div></form>";
}
if ($numRow==1)
$historico[] = 'Exibindo sua última visita:<br>';
else
$historico[] = 'Exibindo suas '.(($numRow<3) ? $numRow : '3').' últimas visitas:<br>';
}
if (isset($historico) && !empty($historico)) {
$countLimit = -1;
if (count($historico)<4)
$count = count($historico)-1;
else if (count($historico)==4)
$count = 3;
else {
$count = count($historico)-1;
$countLimit = count($historico)-5;
}
for ($i=$count; $i>$countLimit; $i--)
echo $historico[$i];
} else
echo "Sem histórico de busca, visite um imóvel ;)";
}
?>
</div>
</div>
</nav>
</nav>
<!-- CONTEUDO -->
<div id="div3" name="div3" class="container-fluid" style="margin: 0" >
<div id="cont" class="col-sm-12">
<?php
if(!isset ($_SESSION['login']) == true){
echo"<style>#btnVperfil{visibility: hidden;}</style>";
}else{
echo"<style>#btnLogin{visibility: hidden;}</style>";
}
?>
<button onclick="abrepagina('login.html')" id="btnLogin">Login</button>
<img src="IMGS/user%20(1).png" id="btnVperfil" onclick="abrepagina('perfil.php')" width="80">
<!--<button onclick="abrepagina('perfil.php')" id="btnVperfil">Ver Perfil</button>-->
<h4 id="text"><strong>Onde fica sua casa dos sonhos ?</strong></h4>
<form name="busca" method="post" action="imoveis.php">
<strong>
<select id="tipo" name="tipoC" >
<option style="color: darkorange" value="todos">Selecione o Tipo</option>
<?php
$query = mysqli_query($conexao, "SELECT * FROM tipo");
while($tipoC = mysqli_fetch_array($query)) { ?>
<option style="color: darkorange" value="<?php echo $tipoC['idTIPO'] ?>">
<?php echo $tipoC['NomeTipo'] ?>
</option>
<?php } ?>
</select>
<select id="cidade" name="cidadeSelect">
<option style="color: darkorange" value="todos">Selecione a Cidade</option>
<?php
$query = mysqli_query($conexao, "SELECT * FROM cidade ");
while($cidade = mysqli_fetch_array($query)) { ?>
<option style="color: darkorange" name="idcidade" id="idcidade" value="<?php echo $cidade['idCIDADE'] ?>">
<?php echo $cidade['NomeCidade'] ?>
</option>
<?php } ?>
</select>
<select id="bairro" name="bairroSelect">
<option style="color: darkorange" value="todos">Selecione o Bairro</option>
<script>
$("#cidade").on("change",function(){
var idEstado = $("#cidade").val();
$.ajax({
url: 'pegaCidade.php',
type: 'POST',
data: {id:idEstado},
beforeSend: function(){
$("#bairro").html("Carregando...");
},
success: function(data){
$("#bairro").html(data);
},
Error: function(data){
$("#bairro").html("ERROR");
}
});
});
</script>
</select><br>
</strong>
<input type="submit" id="btnBusca" value="Buscar">
</form>
</div>
</div>
<!-- DESTAQUES -->
<div id="destaques">
<h1 id="labelText">✮ Itens em Destaques ✮</h1>
<div id="labelDest">
</div>
<div class="container">
<div class="row" id="items">
<?php
$query_destaque = mysqli_query($conexao,"SELECT *, count(idIMOVEL)
FROM hist_imoveis h
LEFT JOIN imovel i on h.FKImovel = i.idIMOVEL
LEFT JOIN bairro b on b.idBAIRRO = i.FKBairro
LEFT JOIN imovel_img c on c.FKImovel = i.idIMOVEL
GROUP BY idIMOVEL DESC
LIMIT 0,6");
if(mysqli_num_rows($query_destaque)==0){
echo "<div class='container-fluid'>
<img src='IMGS/jjtriste.png' style='margin-top:0px;margin-bottom:10px;'>
<h3>EM BREVE IMÓVEIS...</h3><br>
</div>
";
}else{
while($destaques = mysqli_fetch_array($query_destaque)) {
echo"<form method='POST' action='imovel.php'>
<div class='col-md-4'>
<figure class='card card-product'>
<div class='img-wrap'><img src='IMGS/".$destaques['NomeOriginal']."'></div>
<figcaption class='info-wrap'>
<h4 class='title'> ".$destaques['NomeBairro']."</h4>
<p class='desc'>R$ ".$destaques['Preco']."</p>
<div class='rating-wrap'>
<div class='label-rating'>
<i class='fas fa-bed'> ".$destaques['Quartos']." Quartos </i>
<i class='fas fa-car'> ".$destaques['Vaga']." Vagas</i>
<i class='fas fa-hot-tub'> ".$destaques['Suites']." Suítes</i>
<i class='fas fa-arrows-alt'> ".$destaques['Tamanho']."²</i>
<button name='idIMOVEL' value='".$destaques['idIMOVEL']."'style='border:none; background-color:white;color:darkorange; font-size: 15'>
Ver mais</button>
</div>
</div>
</figcaption>
</figure>
</div>
</form>
";
}
}
?>
</div>
</div>
</div>
<div id="Obj" class="container-fluid">
<div class="row">
<div class="col-sm-12">
<h1>Simule seu financiamento</h1>
<hr style="width: 400">
<div class="container">
<div class='row'>
<div class='col-md-12'>
<div class="carousel slide" data-ride="carousel" id="quote-carousel">
<h3>Com o Simulador Caixa Minha Casa Minha Vida o cidadão, cliente e futuro dono de sua casa própria, terá acesso a diversas maneiras de financiar sua casa própria, com valores reais e originais, sem falsas expectativas.
<strong><a href="https://programaminhacasaminhavida.net/simulador-caixa-minha-casa-minha-vida/?gclid=Cj0KCQjwgOzdBRDlARIsAJ6_HNn3B8XRbWHSQBlHGItnbxoHPef8RSthRdd-Rh8czXe5WVDuMQu_pZkaAuJOEALw_wcB" style="color: white">Simule aqui</a></strong></h3><br>
</div>
</div>
</div>
</div>
</div>
<div id="Anuncie" class="col-sm-12" style="text-align:center">
<img src="IMGS/icone%20(2).png" width="100px" style="margin-top: 20px; ">
<h2 style="font-family: Alcubierre;"> Quer anunciar seu imóvel, <a href="#" onclick="abrepagina('cadastraImovel.php')" style="color: orange">Clique aqui</a></h2>
</div>
</div>
</div>
<!-- VERIFICA SE EXISTE UM MODAL PARA FAZER O LOAD -->
<?php if (isset($_GET['modal'])) : ?>
<script>abrepagina('<?=$_GET['modal']?>')</script>
<?php endif; ?>
</body>
</html>