Ir para conteúdo
Fórum Script Brasil
  • 0

Alteração em busca


Henrique Flausino

Pergunta

Boa noite.

Caros.

Tenho um código que estou tentando alterar mas não consigo.

Alterei a tabela do MYSQL para poder cadastrar Estado, Cidade e Bairro, porém não consigo ajustar o código para pesquisar.

Será que alguém poderia me ajudar?

Segue tabela:

admin, bairro, cidade, configure, estado, features, properties, propertyfeatures, propertylocations, propertystatus, propertytypes

Sendo que o propertylocations é o original e eu vou excluir.

Estrutura das tabelas.

Estado:

Id, Descricao

Cidade:

codigo, cod_estado, descricao

Bairro:

codigo, cod_cidade, descricao

properties:

id, agentref, propertyoption, propertyref, propertytype, propertyprice, propertybedrooms, propertybathrooms, propertyyearbuilt, propertylivingarea, propertyplotsize, propertyaddress, propertylocationestado, propertylocationcidade, propertylocationbairro, propertypostcode, propertycountry, shortdescription, longdescription, propertystatus, propertyphoto1, propertyphoto2, propertyphoto3, propertyphoto4, propertyphoto5, propertyphoto6, propertyphoto7, propertyphoto8, propertyphoto9, propertyphoto10, propertyviews, propertyshow, featuredproperty, virtualtour, propertyowner, dateadded

Código fonte.

index.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>SGM Imóveis</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="images/style.css" rel="stylesheet" type="text/css">

<style type="text/css">

<!--

.style1 {color: #000000}

.style3 {font-size: 14px}

.style12 {

    font-size: 11px;

    color: #000;

}

.style10 {font-size: 12px}

body {

    background-image: url(images/bg.gif);

}

-->

</style>

&lt;script src="Scripts/swfobject_modified.js" type="text/javascript"></script>

&lt;script language="JavaScript" type="text/JavaScript">

<!--

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}

function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}

//-->

</script>

</head>

<body>

<table width="980" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">

  <tr>

    <td width="750" height="250" align="center">

    <table width="100%"  border="0" cellspacing="0" cellpadding="0">

      <tr>

        <td align="center"><img src="images/logo.jpg" width="990" height="250" class="logo" /></td>

      </tr>

    </table></td>

  </tr>

  <tr>

    <td valign="top">

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F2F2F2">

        <tr>

          <td width="150" rowspan="2" valign="top"><table width="192" border="0" cellspacing="0" cellpadding="0">

              

              <tr>

                <td align="left" valign="middle">

                <div class="menu-imob"><br />

                    <ul>

                        <li class="bullets"><a href="index.php">Principal</a></li>

                        <li class="bullets"><a href="#" target="_top" onClick="MM_openBrWindow('cadastro/index.php','Cadastro','scrollbars=yes,width=650,height=480')"> Cadastre seu Imóvel</a></li>

                         

                        <li class="bullets"><a href="index.php?op=search&po=S" target="_top"> Imóveis para Venda</a></li>

                        <li class="bullets"><a href="index.php?op=search&po=R" target="_top"> Imóveis para Aluguel</a></li>

                        <li class="bullets"><a href="#" onClick="window.open('contato.php','Janela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=461,height=260'); return false;">Fale Conosco</a><br></li>

                    </ul>

</div>

                <br><strong><span class="style12">     Busca Avançada</span></strong><br><?php include ("includes/templates/inc-searchbox.php"); ?></td>

              </tr>

              <td align="left" valign="middle">           

  <!-- start of searchbox include -->

  <!-- end of searchbox include -->

   <strong> </strong>

   <strong>  </strong><!-- end of price box include --></td>

              </tr>

              <tr>

                <td align="center" valign="middle"><img src="images/white-dot.gif" width="192" height="1"></td>

              </tr>

              <tr>

                <td align="left" valign="middle"> </td>

              </tr>

              <tr>

                <td align="center" valign="middle"><table width="90%"  border="0" cellspacing="0" cellpadding="0">

                  <tr>

                    <td align="left" valign="middle"><p><strong><span class="style12">Busca por Cidade do Imóvel</span></strong><span class="style10">

                    <!-- start of location box include -->

                    </span> </p>

                      <blockquote>

                        <?php include ("includes/templates/inc-locations2.php"); ?>

                      </blockquote>

<p><strong><span class="style12">Busca por Bairro do Imóvel</span></strong><span class="style10">

  <!-- start of location box include -->

  </span>

</p>

                      <blockquote>

                        <?php include ("includes/templates/inc-locations.php"); ?>

                    </blockquote></td>

                  </tr>

                </table>                  <!-- end of location box include --></td>

              </tr>

              <tr>

                <td align="left" valign="middle"> </td>

              </tr>

              <tr>

                <td align="center" valign="middle"><img src="images/white-dot.gif" width="192" height="1"></td>

              </tr>

              <tr>

                <td align="left" valign="middle"> </td>

              </tr>

              <tr>

                <td align="center" valign="middle"><table width="90%"  border="0" cellspacing="0" cellpadding="0">

                  <tr>

                    <td align="left" valign="middle"><strong><span class="style12">Busca por Valor do Imóvel</span> </strong>

                      <blockquote>

                        <?php include ("includes/templates/inc-pricesearch.php"); ?>

                      </blockquote></td>

                  </tr>

                </table></td>

              </tr>

              <tr>

                <td align="center" valign="middle"> </td>

              </tr>

              <tr>

                <td align="center" valign="middle"> </td>

              </tr>

            </table></td>

          <td valign="top" bgcolor="#FFFFFF">

            <table width="100%" border="0" cellpadding="0" cellspacing="0">

              <tr>

                <td> </td>

                <td align="left" valign="top"> </td>

                <td> </td>

              </tr>

              <tr>

                <td width="20"> </td>

                <td width="800" align="left" valign="top"><?php

  if (

  $cgi->getValue ( "op" ) == "search" ||

  $cgi->getValue ( "op" ) == "mi"  ||

  $cgi->getValue ( "sp" ) == "y"||

  $cgi->getValue ( "op" ) == "SendInformationRequest" )

  { include "search_.php"; }

  else { ?>

                  <table width="100%"  border="0" cellspacing="0" cellpadding="0">

                  <tr>

                    <td> </td>

                  </tr>

                  <tr>

                    <td><div align="justify">

                      <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="500" height="300">

                        <param name="movie" value="images/teste2.swf">

  <param name="quality" value="high">

  <param name="wmode" value="opaque">

  <param name="swfversion" value="9.0.45.0">

  <!-- Esta tag param solicita que os usuários com o Flash Player 6.0 r65 e versões posteriores baixem a versão mais recente do Flash Player. Exclua-o se você não deseja que os usuários vejam o prompt. -->

  <param name="expressinstall" value="Scripts/expressInstall.swf">

  <!-- A tag object a seguir aplica-se a navegadores que não sejam o IE. Portanto, oculte-a do IE usando o IECC. -->

  <!--[if !IE]>-->

  <object type="application/x-shockwave-flash" data="images/teste2.swf" width="500" height="300">

    <!--<![endif]-->

    <param name="quality" value="high">

    <param name="wmode" value="opaque">

    <param name="swfversion" value="9.0.45.0">

    <param name="expressinstall" value="Scripts/expressInstall.swf">

    <!-- O navegador exibe o seguinte conteúdo alternativo para usuários que tenham o Flash Player 6.0 e versões anteriores. -->

    <div>

      <h4>O conteúdo desta página requer uma versão mais recente do Adobe Flash Player.</h4>

      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Obter Adobe Flash player" width="112" height="33" /></a></p>

    </div>

    <!--[if !IE]>-->

  </object>

  <!--<![endif]-->

</object>

                    </div></td>

                  </tr>

                  <tr>

                    <td> </td>

                  </tr>

                  <tr>

                      <td height="1" background="images/lista_im.gif"></td>

                    </tr>

                  <tr>

                    <td> </td>

                  </tr>

                  <tr>

                    <td height="30" align="left" valign="middle" bgcolor="#0058A9"><img src="includes/images/destaque.gif" width="189" height="30"></td>

                  </tr>

                  <tr>

                    <td> </td>

                  </tr>

                  <tr>

                    <td> </td>

                  </tr>

                </table>

                  <table width="100%"  border="0" cellspacing="0" cellpadding="0">

                    <tr>

                      <td align="center" valign="middle"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

                        <tr align="center" valign="middle">

                          <td><?PHP include "includes/tools/random-property.php"; ?></td>

                          <td><?PHP include "includes/tools/random-property.php"; ?></td>

                          <td><?PHP include "includes/tools/random-property.php"; ?></td>

                        </tr>

                      </table></td>

                    </tr>

                  </table>  

                  <p>        <?php }

?>         

                </p>  </td><td width="10"> </td>

              </tr>

            </table></td>

        </tr>

        <tr>

          <td bgcolor="#FFFFFF"> </td>

        </tr>

      </table></td>

  </tr>

  <tr>

    <td height="35" align="center" valign="middle" bgcolor="#0058A9">

      <table width="980" border="0" cellspacing="0" cellpadding="0">

        <tr>

          <td width="218"><table width="100%" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td align="right" valign="middle"><img src="includes/images/contato.gif" width="189" height="35"></td>

            </tr>

            <tr>

              <td align="left" valign="middle"> <table width="100%"  border="0" cellspacing="0" cellpadding="0">

                <tr>

                  <td width="26%"> </td>

                  <td width="74%" align="left" valign="middle"><span class="style12" style="color:#fff">Fone: <br>

                        (11) 0000-0000</span></td>

                </tr>

              </table></td>

            </tr>

            <tr>

              <td align="left" valign="middle"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

                <tr>

                  <td width="26%"> </td>

                  <td width="74%" align="left" valign="middle"><span class="style12" style="color:#fff">Fax: <br>

                        (11) 0000-0000</span></td>

                </tr>

              </table></td>

            </tr>

            <tr>

              <td align="left" valign="middle"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

                <tr>

                  <td width="26%"> </td>

                  <td width="74%" align="left" valign="middle"> </td>

                </tr>

              </table></td>

            </tr>

            <tr>

              <td align="left" valign="middle"> </td>

            </tr>

          </table></td>

          <td width="762" align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td height="25"> </td>

            </tr>

            <tr>

                <td align="center" valign="middle"><p><span class="baseline">©

                    Copyright <?php echo date("Y"); ?> M&F Design.</span> </p>

                  <p> </p></td>

            </tr>

          </table></td>

        </tr>

      </table></td>

  </tr>

</table>

&lt;script type="text/javascript">

swfobject.registerObject("FlashID");

</script>

</body>

</html>
inc-searchbox.php
<link href="../../images/style.css" rel="stylesheet" type="text/css">

<?php

require ( "includes/config.php" );

require ( "includes/CGI.php" );

require ( "includes/SQL.php" );

$cgi = new CGI ();

$sql = new SQL ( $DBusername, $DBpassword, $server, $database );

if ( ! $sql->isConnected () )

{

  die ( $DatabaseError );

}

require ( "includes/CSQL.php" );

require ( "includes/lang/" . $language_pack . "/index.php" );

?>

<style type="text/css">

<!--

.style1 {

    color: #FFFFFF;

    font-weight: bold;

}

.style2 {color: #FFFFFF}

-->

</style>

<form method="get" action="<?php echo "$template_page_name"; ?>">

<input name="op" type="hidden" value="search" />

<table width="233" height="297" border="0" align="center"  cellpadding="2" cellspacing="2">

<?php if($display_search_types == "Y") { ?>

<tr>

<td width="87" height="25"><p align="right" class="menu style1" style="color:#000">Tipo:</p></td>

<td width="128"><p>

<select name="pt" size="1" style="height: 18px; width:125px;">

<option value="" selected="selected"><?php echo FORM_SELECT_ALL_TYPES; ?></option>

<?PHP

    $rows = $sql->execute ( "SELECT * FROM " . $propertytypes_table .

        " ORDER BY propertytype ASC", SQL_RETURN_ASSOC );

    for ( $i = 0; $i < sizeof ( $rows ); ++$i )

    {

      $row = $rows [ $i ];

     

      ?>

<option value="<?php echo $cgi->htmlEncode ( $row [ "id" ] ); ?>">

<?php

      echo $cgi->htmlEncode ( $row [ "propertytype" ] ); ?>

</option>

<?php

    }

?>

</select>

</p></td>

</tr>

<?php }

if($display_search_max_price == "Y") {

?>

<tr>

<td class="b2" height="25"><p align="right" class="style1" style="color:#000">Menor Valor:</p></td>

<td><p>

<select name="pp_max" style="height: 18px; width:125px;">

<?php if (($display_sale) == "Y"){ ?>

<option value="45000" selected="selected"><?php echo CURRENCY; ?> 45.000,00</option>

<option value="65000"><?php echo CURRENCY; ?> 65.000,00</option>

<option value="75000"><?php echo CURRENCY; ?> 75.000,00</option>

<option value="100000"><?php echo CURRENCY; ?> 100.000,00</option>

<option value="125000"><?php echo CURRENCY; ?> 125.000,00</option>

<option value="150000"><?php echo CURRENCY; ?> 150.000,00</option>

<option value="175000"><?php echo CURRENCY; ?> 175.000,00</option>

<option value="200000"><?php echo CURRENCY; ?> 200.000,00</option>

<option value="300000"><?php echo CURRENCY; ?> 300.000,00</option>

<option value="400000"><?php echo CURRENCY; ?> 400.000,00</option>

<option value="500000"><?php echo CURRENCY; ?> 500.000,00</option>

<option value="600000"><?php echo CURRENCY; ?> 600.000,00</option>

<option value="700000"><?php echo CURRENCY; ?> 700.000,00</option>

<option value="800000"><?php echo CURRENCY; ?> 800.000,00</option>

<option value="900000"><?php echo CURRENCY; ?> 900.000,00</option>

<option value="1000000"><?php echo CURRENCY; ?> 1.000,000,00</option>

<option value="2000000"><?php echo CURRENCY; ?> 2.000,000,00</option>

<?php } if (($display_rental) == "Y"){ ?>

<option value=""><?php echo FORM_DISPLAY_RENTAL_SELECT; ?></option>

<option value="200"><?php echo CURRENCY; ?> 200,00</option>

<option value="300"><?php echo CURRENCY; ?> 300,00</option>

<option value="400"><?php echo CURRENCY; ?> 400,00</option>

<option value="500"><?php echo CURRENCY; ?> 500,00</option>

<option value="750"><?php echo CURRENCY; ?> 750,00</option>

<?php } ?>

</select>

</p></td>

</tr>

<tr>

<td height="25"><p align="right" class="copyright style2"><strong style="color:#000">Maior  Valor:</strong></p></td>

<td><p>

<select name="pp_min" style="height: 18px; width:125px;">

<?php if (($display_sale) == "Y"){ ?>

<option value="100"><?php echo CURRENCY; ?> 100,00</option>

<option value="125"><?php echo CURRENCY; ?> 125,00</option>

<option value="150"><?php echo CURRENCY; ?> 150,00</option>

<option value="175"><?php echo CURRENCY; ?> 175,00</option>

<option value="200"><?php echo CURRENCY; ?> 200,00</option>

<option value="300"><?php echo CURRENCY; ?> 300,00</option>

<option value="400"><?php echo CURRENCY; ?> 400,00</option>

<option value="500"><?php echo CURRENCY; ?> 500,00</option>

<option value="600"><?php echo CURRENCY; ?> 600,00</option>

<option value="700"><?php echo CURRENCY; ?> 700,00</option>

<option value="800"><?php echo CURRENCY; ?> 800,00</option>

<option value="900"><?php echo CURRENCY; ?> 900,00</option>

<option value="1000"><?php echo CURRENCY; ?> 1.000,00</option>

<option value="2000" selected="selected"><?php echo CURRENCY; ?> 2.000,00</option>

<?php } if (($display_rental) == "Y"){ ?>

<option value=""><?php echo FORM_DISPLAY_RENTAL_SELECT; ?></option>

<option value="200"><?php echo CURRENCY; ?> 200,00</option>

<option value="300"><?php echo CURRENCY; ?> 300,00</option>

<option value="400"><?php echo CURRENCY; ?> 400,00</option>

<option value="500"><?php echo CURRENCY; ?> 500,00</option>

<option value="750"><?php echo CURRENCY; ?> 750,00</option>

<option value="1000"><?php echo CURRENCY; ?> 1.000,00</option>

<option value="1500"><?php echo CURRENCY; ?> 1.500,00</option>

<?php } ?>

</select>

</p></td>

</tr>

<?php }  if($display_search_bedrooms == "Y") { ?>

<tr>

<td height="25"><p align="right" class="style2 copyright"><strong style="color:#000"> Quartos:</strong></p></td>

<td><p>

<select name="pb" style="height: 18px; width:125px;">

<option value="0" selected="selected"><?php echo FORM_NO_PREFERENCE; ?></option>

<option value="1">1</option>

<option value="2">2</option>

<option value="3">3</option>

<option value="4">4</option>

<option value="5">5</option>

</select>

</p></td>

</tr>

<?php }  if($display_search_locations == "Y") { ?>

<tr>

<td height="25"><b>Estado:</b>:</strong></td>

<td>&lt;script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>

&lt;script type="text/javascript" src="js/cbox.js"></script><p>

  <select name="categoria">

    <option value="0">Escolha um Estado</option>

    <?php

include("include/connect_data_base.php");

$sql_cat=mysql_query("SELECT * FROM estado ORDER BY descricao ASC") or die(mysql_error());

while($result_sql_cat = mysql_fetch_object($sql_cat)){

echo '<option value="'.$result_sql_cat->id.'">'.$result_sql_cat->descricao.'</option>';

}

?>

    <!--  -->

  </select>

  </p>

</td>

</tr>

<?php } ?>

<?php

if (($display_rental & $display_sale) == "Y"){

echo "<TR><TD></TD><TD><p><input name=\"po\" type=\"radio\" value=\"S\"><font color=\"#000000\" face=\"Arial\" size=\"2\">Vendas</font><br>

<input name=\"po\" type=\"radio\" value=\"R\"><font color=\"#000000\" face=\"Arial\" size=\"2\">Aluguel</font><br></p></TD></TR>";

}

elseif (($display_rental) == "Y"){

echo "<TR><TD></TD><TD><p>

<input name=\"po\" type=\"hidden\" value=\"R\"></p></TD></TR>";

}

elseif (($display_sale) == "Y"){

echo "<TR><TD></TD><TD><p>

<input name=\"po\" type=\"hidden\" value=\"S\"></p></TD></TR>";

}

?>

<tr>

<td height="38"><b>Cidade:</b></td>

<td>

  <select name="cidade">

    <option value="0" disabled="disabled">Escolha um Estado Primeiro</option>

  </select>

</td>

</tr>

<tr>

  <td height="38"><b>Bairro</b></td>

  <td><select name="bairro">

    <option value="0" disabled="disabled">Escolha uma Cidade Primeiro</option>

  </select></td>

</tr>

<tr>

  <td height="38"></td>

  <td> </td>

</tr>

<tr>

  <td height="38"></td>

  <td><input name="input" type="image" src="<?php print "$LanguageFolder/$language_pack"; ?>/buttons/button-search.gif" /></td>

</tr>

</table>

</form>
inc-locations.php
<?php

require ( "includes/config.php" );

require ( "includes/CGI.php" );

require ( "includes/SQL.php" );

$cgi = new CGI ();

$sql = new SQL ( $DBusername, $DBpassword, $server, $database );

if ( ! $sql->isConnected () )

{

  die ( $DatabaseError );

}

require ( "includes/CSQL.php" );

require ( "includes/lang/" . $language_pack . "/index.php" );

// Get the property locations from the database and display them in alpha order

    {        

    $rows = $sql->execute ( "SELECT * FROM " . $bairro_table .

      " ORDER BY descricao ASC", SQL_RETURN_ASSOC );

    $num = sizeof ( $rows );      

      for ( $i = 0; $i < $num; ++$i )

      {

        $id = $rows [ $i ] [ "codigo" ];

        $propertylocation = $rows [ $i ] [ "descricao" ];

  echo "<img src=\"includes/images/arrow_blue.gif\" width=\"10\" height=\"13\">  <a href=\"$template_page_name?op=search&pl=$id\" style=\"color:#000\">$propertylocation</a><br>";        

}

  }

?>
inc-locations2.php
<?php

require ( "includes/config.php" );

require ( "includes/CGI.php" );

require ( "includes/SQL.php" );

$cgi = new CGI ();

$sql = new SQL ( $DBusername, $DBpassword, $server, $database );

if ( ! $sql->isConnected () )

{

  die ( $DatabaseError );

}

require ( "includes/CSQL.php" );

require ( "includes/lang/" . $language_pack . "/index.php" );

// Get the property locations from the database and display them in alpha order

    {        

    $rows = $sql->execute ( "SELECT * FROM " . $cidade_table .

      " ORDER BY descricao ASC", SQL_RETURN_ASSOC );

    $num = sizeof ( $rows );      

      for ( $i = 0; $i < $num; ++$i )

      {

        $id = $rows [ $i ] [ "codigo" ];

        $propertylocation = $rows [ $i ] [ "descricao" ];

  echo "<img src=\"includes/images/arrow_blue.gif\" width=\"10\" height=\"13\">  <a href=\"$template_page_name?op=search&pl=$id\" style=\"color:#000\">$propertylocation</a><br>";        

}

  }

?>
layout_view.php
<?php

  

  $layoutId = $cgi->getValue ( "id" );

  $rows = $sql->execute ( "SELECT * FROM " . $property_table . " WHERE id=" .

    $sql->quote ( $layoutId ) . " AND propertyshow=1 LIMIT 1",

    SQL_RETURN_ASSOC );

  $row = $rows [ 0 ];

  $Price = number_format ( $row [ 'propertyprice' ], 2, ",", "." );

  $sql->execute ( "UPDATE " . $property_table .

      " SET propertyviews=(propertyviews + 1) WHERE id=" .

      $sql->quote ( $layoutId ) . " LIMIT 1" );

$ThumbPhotoWidth = "100";

$ThumbPhotoHeight = "80";

?>

<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">

<tr valign="top">

  <td colspan="2" valign="top"><table width="100%" border="0"  align="center" cellpadding="0" cellspacing="0" class="lvp_top_nav_menu_bg">

    <tr valign="middle">

      <td>  <?php echo LV_PROPERTY_REF; ?> <strong><?php echo $row [ "propertyref" ]; ?></strong> - <?php echo $row [ "propertyaddress" ]; ?> - <?php echo $_GET [ "pl" ]; ?> - Cep: <?php echo $row [ "propertypostcode" ]; ?></td>

      <td align="right"> <a href="?sp=y&id=<?php echo $row [ "id" ]; ?>"><img src="includes/lang/<?php print "$language_pack"; ?>/buttons/button-view-photos.gif" title="Ver Fotos" border="0" /></a> <a href="java script:history.go(-1)"><img src="includes/lang/<?php print "$language_pack"; ?>/buttons/button-back.gif" title="Voltar" border="0" /></a></td>

    </tr>

  </table></td>

  </tr>

<tr valign="top">

<td width="48%" valign="top"><?php   if ( ! $row [ 'propertyphoto1' ] )

  {

    ?>

  <img src="<?php echo $ImageURL; ?>nopropertyimage.jpg" border="0" />

  <?php

  }

  else

  {

    ?>

  <table cellpadding="0" cellspacing="1">

    <tr>

      <td width="300" height="300" align="center" valign="top"><img src="<?php echo $ImageURL; ?><?php echo $row [ "propertyphoto1" ]; ?>" name="large" hspace="10"  border="0" align="left" id="large" />

          </td>

    </tr>

    <tr>

      <td width="300" align="center" valign="top"><table cellpadding="0" cellspacing="2">

          <tr>

            <td valign="middle" align="center"><?php if ($row [ 'propertyphoto1' ] ) { echo "<img src=\"$ImageURL$row[propertyphoto1]\" width=\"$ThumbPhotoWidth\" height=\"$ThumbPhotoHeight\" border=\"0\" onmousedown=\"document.images['large'].src='$ImageURL$row[propertyphoto1]'\">";} ?>            </td>

            <td valign="middle" align="center"><?php if ($row [ 'propertyphoto2' ] ) { echo "<img src=\"$ImageURL$row[propertyphoto2]\" width=\"$ThumbPhotoWidth\" height=\"$ThumbPhotoHeight\" border=\"0\" onmousedown=\"document.images['large'].src='$ImageURL$row[propertyphoto2]'\">";} ?></td>

            <td valign="middle" align="center"><?php if ($row [ 'propertyphoto3' ] ) { echo "<img src=\"$ImageURL$row[propertyphoto3]\" width=\"$ThumbPhotoWidth\" height=\"$ThumbPhotoHeight\" border=\"0\" onmousedown=\"document.images['large'].src='$ImageURL$row[propertyphoto3]'\">";} ?></td>

          </tr>

          <tr>

            <td valign="middle" align="center"><?php if ($row [ 'propertyphoto4' ] ) { echo "<img src=\"$ImageURL$row[propertyphoto4]\" width=\"$ThumbPhotoWidth\" height=\"$ThumbPhotoHeight\" border=\"0\" onmousedown=\"document.images['large'].src='$ImageURL$row[propertyphoto4]'\">";} ?>            </td>

            <td valign="middle" align="center"><?php if ($row [ 'propertyphoto5' ] ) { echo "<img src=\"$ImageURL$row[propertyphoto5]\" width=\"$ThumbPhotoWidth\" height=\"$ThumbPhotoHeight\" border=\"0\" onmousedown=\"document.images['large'].src='$ImageURL$row[propertyphoto5]'\">";} ?>            </td>

            <td valign="middle" align="center"><?php if ($row [ 'propertyphoto6' ] ) { echo "<img src=\"$ImageURL$row[propertyphoto6]\" width=\"$ThumbPhotoWidth\" height=\"$ThumbPhotoHeight\" border=\"0\" onmousedown=\"document.images['large'].src='$ImageURL$row[propertyphoto6]'\">";} ?>            </td>

          </tr>

          <tr>

            <td valign="middle" align="center"><?php if ($row [ 'propertyphoto7' ] ) { echo "<img src=\"$ImageURL$row[propertyphoto7]\" width=\"$ThumbPhotoWidth\" height=\"$ThumbPhotoHeight\" border=\"0\" onmousedown=\"document.images['large'].src='$ImageURL$row[propertyphoto7]'\">";} ?>            </td>

            <td valign="middle" align="center"><?php if ($row [ 'propertyphoto8' ] ) { echo "<img src=\"$ImageURL$row[propertyphoto8]\" width=\"$ThumbPhotoWidth\" height=\"$ThumbPhotoHeight\" border=\"0\" onmousedown=\"document.images['large'].src='$ImageURL$row[propertyphoto8]'\">";} ?>            </td>

            <td valign="middle" align="center"><?php if ($row [ 'propertyphoto9' ] ) { echo "<img src=\"$ImageURL$row[propertyphoto9]\" width=\"$ThumbPhotoWidth\" height=\"$ThumbPhotoHeight\" border=\"0\" onmousedown=\"document.images['large'].src='$ImageURL$row[propertyphoto9]'\">";} ?>            </td>

          </tr>

          <tr>

            <td valign="middle" align="center"><?php if ($row [ 'propertyphoto10' ] ) { echo "<img src=\"$ImageURL$row[propertyphoto10]\" width=\"$ThumbPhotoWidth\" height=\"$ThumbPhotoHeight\" border=\"0\" onmousedown=\"document.images['large'].src='$ImageURL$row[propertyphoto10]'\">";} ?>            </td>

            <td valign="middle" align="center"></td>

            <td valign="middle" align="center"></td>

          </tr>

      </table></td>

    </tr>

  </table> <?php } ?> </td>

<td width="52%" align="left" valign="top"><p><?php echo $row [ "shortdescription" ]; ?></p>

<table width="100%" border="0" cellspacing="0" cellpadding="5">

  <tr>

    <td align="left" valign="top">

<p><strong>Valor:</strong> <strong><?php echo CURRENCY; ?> <?php echo "$Price"; ?></strong></p>

<p>

  <?php

  if ( $row [ 'propertybedrooms' ] )

  {

    echo " $row[propertybedrooms] - Quartos<br>";

  }

    if ( $row [ 'propertybathrooms' ] )

  {

    echo "$row[propertybathrooms] - Banheiros";

  }    

    ?>

</p>

<?php

  $_features = $sql->execute ( "SELECT description FROM " .

      $features_table . " INNER JOIN " . $propertyfeatures_table .

      " ON (id=feature_id) WHERE property_id=" .

      $sql->quote ( $layoutId ),

      SQL_RETURN_ASSOC );

  $features = array ();

  if ( $row [ 'propertyyearbuilt' ] )

  {

    $features [] = "Construído em $row[propertyyearbuilt]";

  }

  if ( $row [ 'propertylivingarea' ] )

  {

    $features [] = "$row[propertylivingarea] Área Construída";

  }

  if ( $row [ 'propertyplotsize' ] )

  {

    $features [] = "$row[propertyplotsize] Área Total";

  }

  for ( $i = 0; $i < sizeof ( $_features ); ++$i )

  {

    $features [] = $cgi->htmlEncode ( $_features [ $i ] [ "description" ] );

  }

  for ( $i = 0; $i < sizeof ( $features ); ++$i )

  {

?>

  <p><?php echo $cgi->htmlEncode ( $features [ $i ] ); ?></p>

  <?php

  }

?></td>

    </tr>

</table></td>

</tr>

<tr valign="top">

<td colspan="2" valign="top">

<p align="left"><?php echo nl2br($row [ "longdescription" ]); ?></p></td>

</tr>

</table>

<table width="540" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr align="center" valign="middle">

    <td width="150"><a href="#CONTACT"><img src="includes/images/link-requestinformation.gif" width="150" height="40" border="0"></a></td>

    <td width="20"> </td>

    <td width="174"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">

      <tr>

        <td align="center" valign="middle"><?php $MapLinkUrl = str_replace("XXXXXX", "$row[propertypostcode]", "$property_map_url"); if ($row [ 'propertypostcode' ] ) { print "<td></td><td><a href=\"$MapLinkUrl\" target=\"new\"><img src=\"includes/images/link-map.gif\" border=\"0\"/></a></td>";} ?></td>

      </tr>

    </table></td>

    <td width="20"> </td>

    <td width="176"><a href="includes/templates/printfactsheet.php?id=<?php echo $row [ "id" ]; ?>" target="_blank"><img src="includes/images/link-print.gif" width="176" height="40" border="0"></a></td>

  </tr>

</table>

<p> </p>
layout_results.php
<?php

  $Price = number_format ($row [ 'propertyprice' ], 2, ",", ".");

?>

<table width="100%" align="center" class="lrp_bg">

    <tr valign="middle">

  <td colspan="2" valign="middle" align="left">

  <p> <font  size="-1"><b><?php echo $row [ "propertyaddress" ]; ?>

  - <?php echo $cgi->htmlEncode ( $row [ "codigo" ] ); ?></b></font></p></td>

    <td valign="middle" align="right"><p class="propertystatus"><?php

  echo strtoupper ( $cgi->htmlEncode ( $row [ "propertystatus" ] ) );

          ?> </p></td>

</tr>

    <tr>

      <td colspan="3" bgcolor="#FFFFFF">

       <table width="100%" cellpadding="3" cellspacing="1">

        <tr>

          <td><p align="center">

<?php

  if ( ! $row [ "propertyphoto1" ] )

  {

    ?><img src="<?php echo $ImageURL; ?>nopropertyimage.jpg" height="<?php

    echo $max_thumb_image_height; ?>" width="<?php echo $max_thumb_image_width; ?>"

      border="0" /><?php

  }

  else

  {

    ?><a href="?op=mi&id=<?php echo $row [ "id" ]; ?>&pl=<?php echo $row [ "propertylocation" ]; ?>"><img src="<?php

    echo $ImageURL; ?><?php echo $row [ "propertyphoto1" ]; ?>" height="<?php

    echo $max_thumb_image_height; ?>" width="<?php echo $max_thumb_image_width; ?>"

      border="0" alt="<?php

      echo $row [ "propertyaddress" ]; ?>, <?php

      echo $row [ "propertylocation" ]; ?>" title="<?php

      echo $row [ "propertyaddress" ]; ?>, <?php

      echo $row [ "propertylocation" ]; ?>" /></a><?php

  }

  ?></p></td>

          <td valign="top" align="left" width="100%">

   <table width="100%" cellpadding="1" cellspacing="1">

    <tr>

      <td>

    <p><?php echo LR_PROPERTY_TYPE; ?> <b><?php echo $row [ "propertytype" ]; ?></b></p></td>

      <td>

    <p><?php echo LR_PROPERTY_PRICE; ?> <b><?php echo CURRENCY, $Price; ?></b></p></td>

   </tr>

    <tr>

      <td>

    <p><?php echo LR_PROPERTY_REF; ?> <b><?php echo $row [ "propertyref" ]; ?></b></p></td>

      <td>

      <p>

    <?php if ($row [ "propertybedrooms" ] == "0") { echo "";} else { ?>    

    <?php echo LR_NUMBER_OF_BEDROOMS; ?> <b><?php echo $row [ "propertybedrooms" ]; ?></b>

    <?php } ?></p></td>

   </tr>

   </table>

           <p>

         <?php echo $row [ "shortdescription" ]; ?></p>

         <p align="right"><a href="?op=mi&id=<?php echo $row [ "id" ];

         ?>&pl=<?php echo $row [ "propertylocation" ]; ?>"><img src="<?php print "$LanguageFolder/$language_pack"; ?>/buttons/button-moreinformation.gif" title="Veja mais detalhes" border="0" /></a></p></td>

       </tr>

    </table></td>

</tr>

</table>

<br />

<br />
search_.php
<?php

require ( "includes/config.php" );

require ( "includes/CGI.php" );

require ( "includes/SQL.php" );

$cgi = new CGI ();

$sql = new SQL ( $DBusername, $DBpassword, $server, $database );

if ( ! $sql->isConnected () )

{

  die ( $DatabaseError );

}

require ( "includes/CSQL.php" );

require ( "includes/lang/" . $language_pack . "/index.php" );

?>

<!--

//  comment this out, allows you to use your own stylesheet with propertymax pro

<link rel="stylesheet" href="includes/lang/<?php print "$language_pack"; ?>/style.css" />

-->

&lt;script language="JavaScript" type="text/javascript">

<!-- Begin

var submitcount=0;

function reset() {

document.emailform.name.value="";

document.emailform.email.value="";

document.emailform.address.value="";

}

function checkFields() {                    

if (                                    

(document.emailform.name.value=="") ||

(document.emailform.email.value=="")  ||

(document.emailform.address.value==""))  

   {

   alert("<?php echo GENERAL_FORM_POPUP_ERROR_MESSAGE; ?>");

   return false;

   }

}

//  End --></script>

<?php

  if ( $cgi->getValue ( "op" ) == "SendInformationRequest" )

  {

// Contact Form Spam Check for Website URl's which should not be there

$SpamErrorMessage = "<p align=\"center\"><font color=\"red\">Website URLs are not permitted in the request form.</font></b></p>";

if (preg_match("/http/", "" . $cgi->getValue ( "name" ) . "")) {echo "$SpamErrorMessage"; exit();}

if (preg_match("/http/", "" . $cgi->getValue ( "email" ) . "")) {echo "$SpamErrorMessage"; exit();}

if (preg_match("/http/", "" . $cgi->getValue ( "telephone" ) . "")) {echo "$SpamErrorMessage"; exit();}

if (preg_match("/http/", "" . $cgi->getValue ( "address" ) . "")) {echo "$SpamErrorMessage"; exit();}

    $yoursubject = "".EMAIL_SUBJECT." Cod. " . $cgi->getValue ( "propertyref" );

    $emailtext = "

-----------------------------------------------------------------------------

   ".EMAIL_TEXT_TITLE."

-----------------------------------------------------------------------------

".EMAIL_TEXT_BODY."

".EMAIL_PD."

".EMAIL_PROEPRTY_REF."      " . $cgi->getValue ( "propertyref" ) . "

".EMAIL_PROPERTY_ADDRESS."  " . $cgi->getValue ( "propertyaddress" ) . "

".EMAIL_PROPERTY_PRICE."    ".CURRENCY.""  . $cgi->getValue ( "propertyprice" ) . "

".EMAIL_RD."

".EMAIL_NAME."    " . $cgi->getValue ( "name" ) . "

".EMAIL_EMAIL_ADDRESS."   " . $cgi->getValue ( "email" ) . "

".EMAIL_TELEPHONE."   " . $cgi->getValue ( "telephone" ) . "

" . $cgi->getValue ( "address" ) . "

________________________________

".EMAIL_FOOTER."

";

    $yoursubject = stripslashes ( $yoursubject );

    $emailtext = stripslashes ( $emailtext );

    @mail ( $cgi->getValue ( "adminemailaddress" ), $yoursubject, $emailtext,

        "From: " . $cgi->getValue ( "email" ) );

?>

<br />

<br />

<br />

<p align="center"><?php echo EMAIL_SUCCESS_MESSAGE; ?></p>

<br />

<p align="center">[<a href="?op=search&po=S"><?php echo FORM_VIEW_ALL_SALE_PROPERTIES; ?></a>]</p>

<br />

<br />

<?php

  }

  // view more information about the property if requested

  if ( $cgi->getValue ( "op" ) == "mi" )

  {

  // Start of Display Output

    require ( "includes/templates/layout_view.php" );

  // End of Display output

    $arows = $sql->execute ( "SELECT * FROM " . $admin_table . " LIMIT 1",

        SQL_RETURN_ASSOC );

    $arow = $arows [ 0 ];

?>

<table width="100%"  align="center" class="lvp_top_nav_menu_bg">

<tr valign="top">

<td><p><?php echo LV_MORE_INFORMATION_TITLE; ?></p></td>

</tr>

</table>

<a name="CONTACT" id="CONTACT"></a>

<p align="center"><?php echo LV_MORE_INFORMATION_TEXT; ?></p>

<br />

<table width="85%" align="center" cellpadding="10">

<tr>

<td valign="top"><p><strong><?php echo $cgi->htmlEncode ( $arow [ "adminbusinessname" ] ); ?></strong><br />

<?php echo $cgi->htmlEncode ( $arow [ "adminaddress" ] ); ?><br />

<?php echo $cgi->htmlEncode ( $arow [ "admintown" ] ); ?><br />

<?php echo $cgi->htmlEncode ( $arow [ "admincounty" ] ); ?><br />

<?php echo $cgi->htmlEncode ( $arow [ "adminpostcode" ] ); ?></p>

<p>Tel: <?php echo $cgi->htmlEncode ( $arow [ "admintelephone" ] ); ?><br />

Fax: <?php echo $cgi->htmlEncode ( $arow [ "adminfax" ] ); ?></p></td>

<td><form method="post" name="emailform" id="emailform" onsubmit="return checkFields()">

<input name="op" type="hidden" value="SendInformationRequest" />

<input name="propertyref" type="hidden" value="<?php echo $cgi->htmlEncode ( $row [ "propertyref" ] ); ?>" />

<input name="propertyaddress" type="hidden" value="<?php echo $cgi->htmlEncode ( $row [ "propertyaddress" ] ); ?>" />

<input name="propertylocation" type="hidden" value="<?php echo $cgi->htmlEncode ( $row [ "propertylocation" ] ); ?>" />

<input name="propertyprice" type="hidden" value="<?php echo $cgi->htmlEncode ( $row [ "propertyprice" ] ); ?>" />

<input name="adminemailaddress" type="hidden" value="<?php

                    echo $cgi->htmlEncode ( $arow [ "adminemailaddress" ] ); ?>" />

<table cellpadding="1" cellspacing="1">

<tr>

<td align="right"><p><?php echo LV_NAME; ?> </p></td>

<td><input type="text" name="name" size="35"

                      maxlength="100" /></td>

</tr>

<tr>

<td align="right"><p><?php echo LV_EMAIL; ?> </p></td>

<td><input type="text" name="email" size="35"

                      maxlength="100" /></td>

</tr>

<tr>

<td align="right"><p><?php echo LV_TELEPHONE; ?> </p></td>

<td><input type="text" name="telephone" size="35"

                      maxlength="100" /></td>

</tr>

<tr>

<td align="right" valign="top"><p><?php echo LV_ADDRESS; ?> </p></td>

<td><textarea name="address" rows="5" cols="35"></textarea></td>

</tr>

<tr>

<td align="right" valign="top"> </td>

<td><input name="" type="image" src="<?php print "$LanguageFolder/$language_pack"; ?>/buttons/button-send-request.gif" /></td>

</tr>

</table>

<p> </p>

</form></td>

</tr>

</table>

<?php

  }

  else if ( $cgi->getValue ( "op" ) == "search" )

  {

    $pt = $cgi->getValue ( "pt" );

    $pp = $cgi->getValue ( "pp" );

    $pb = $cgi->getValue ( "pb" );

    $pl = $cgi->getValue ( "pl" );

    $po = $cgi->getValue ( "po" );

    $pp_min = $cgi->getValue ( "pp_min" );

    $pp_max = $cgi->getValue ( "pp_max" );

    $query = "

      SELECT

        p.id                AS id,

        p.propertyoption    AS propertyoption,

        p.propertyprice     AS propertyprice,

        p.propertyaddress   AS propertyaddress,

        pl.propertylocation AS propertylocation,

        ps.propertystatus   AS propertystatus,

        pt.propertytype     AS propertytype,

        p.propertyref       AS propertyref,

        p.propertybedrooms  AS propertybedrooms,

        p.propertyphoto1    AS propertyphoto1,

        p.propertyphoto2    AS propertyphoto2,

        p.propertyphoto3    AS propertyphoto3,

        p.propertyphoto4    AS propertyphoto4,

        p.shortdescription  AS shortdescription,

        p.longdescription   AS longdescription,

        p.virtualtour   AS virtualtour

      FROM

        " . $property_table . " p

        INNER JOIN

        " . $propertytypes_table . " pt ON (p.propertytype=pt.id)

        INNER JOIN

        " . $propertylocations_table . " pl ON (p.propertylocation=pl.id)

        INNER JOIN

        " . $propertystatus_table . " ps ON (p.propertystatus=ps.id)

      WHERE

        p.propertyshow=1

      ";

    if ( $pt != "" )

      $query .= " AND p.propertytype=" . $sql->quote ( $pt );

    if ( $pp_min != "" )

      $query .= " AND p.propertyprice>=" . $sql->quote ( $pp_min );

    if ( $pp_max != "" )

      $query .= " AND p.propertyprice<=" . $sql->quote ( $pp_max );

     

    if ( $pb != "" )

      $query .= " AND p.propertybedrooms>=" . $sql->quote ( $pb );

    if ( $pl != "" )

      $query .= " AND p.propertylocation=" . $sql->quote ( $pl );

    if ( $po != "" )

      $query .= " AND p.propertyoption=" . $sql->quote ( $po );

    // set the query ordering

    if ( isset ( $property_search_order ) && $property_search_order != "" )

      $query .= "ORDER BY p." . $property_search_order . " " .

           ( "a" == strtolower ( substr ( $property_search_ordering, 0, 1 ) ) ?

             "ASC" : "DESC" );

    

    $results = $sql->execute ( $query, SQL_RETURN_ASSOC );

    

    $total_results = sizeof ( $results );

    if ( $total_results == 0 )

    {

      ?>

<br />

<br />

<p align="center"><?php echo GENERAL_NO_PROPERTIES_FOUND; ?></p>

<br />

<br />

<br />

<?php

    }

if ( $total_results  >0 ) {    

    $total_pages = ceil ( $total_results / $property_search_limit ); //total number of pages

    $page = $cgi->getValue ( "page" );

    if ( ! $page )

      $page = 1;

     

    $offset = ( $page - 1 ) * $property_search_limit; //starting number for displaying results out of DB

    $max = $offset + $property_search_limit;

    $max = ( $max > $total_results ? $total_results : $max );

    

?>

<p align="center"><?php echo GENERAL_PROPERTIES_FOUND; ?></p>

<br />

<?php

    for ( $l = $offset; $l < $max; ++$l )

    {

      $row = $results [ $l ];

     

      // Start of Display Output

      require ( "includes/templates/layout_results.php" );

      // End of Display output

    }  

    ?>

<div align="center">

<p><?php echo GENERAL_PAGE; ?> -

<?php

    

    if ( $page != 1 )

    {

    ?>

<a href="<?php echo $_SERVER [ 'PHP_SELF' ]; ?>?op=search&page=1&po=<?php echo $po; ?>&pt=<?php echo $pt; ?>&pp=<?php echo $pp; ?>&pb=<?php echo $pb; ?>&pl=<?php echo $pl; ?>&pp_min=<?php echo $pp_min; ?>&pp_max=<?php echo $pp_max; ?>"><< Voltar </a>  -

<?php

     

      $prevpage = $page - 1;

    }

    $to = ( $page < $total_pages - 2 ? $page + 3 : $total_pages );

    $from = ( $page >= 1 && $page <= 3 ? 1 : $page - 3 );

    for ( $i = $from; $i <= $to; ++$i )

    {

      if ( $i == $total_results )

        $to = $total_results;

        

      if ( $i != $page )

      {

        ?>

<a href="?op=search&showold=yes&page=<?php echo $i; ?>&po=<?php echo $po; ?>&pt=<?php echo $pt; ?>&pp=<?php echo $pp; ?>&pb=<?php echo $pb; ?>&pl=<?php echo $pl; ?>&pp_min=<?php echo $pp_min; ?>&pp_max=<?php echo $pp_max; ?>"><?php echo $i; ?></a>

<?php

      }

      else

      {

        ?>

<b>[<?php echo $i; ?>]</b>

<?php

      }

     

      if ( $i != $total_pages )

        ?>

<?php

    }

    if ( $page != $total_pages )

    {

      $nextpage = $page + 1;

      ?>

-  <a href="?op=search&page=<?php echo $total_pages; ?>&po=<?php echo $po; ?>&pt=<?php echo $pt; ?>&pp=<?php echo $pp; ?>&pb=<?php echo $pb; ?>&pl=<?php echo $pl; ?>&pp_min=<?php echo $pp_min; ?>&pp_max=<?php echo $pp_max; ?>">Próximo>></a>

<?php

    }

    ?>

</p>

</div>

<br />

<br />

<?php

  }

}

  else if ( $cgi->getValue ( "sp" ) == "y" )

{

      // Start of Display Output

      require ( "includes/templates/layout_view_photos.php" );

      // End of Display output

}

  else

  {

    if ( !$cgi->getValue ( "op" ) == "SendInformationRequest" )

  {

    ?>

<br />

<br />

<h2 align="center"><?php echo FORM_TITLE; ?></h2>

<p align="center"><?php echo FORM_SEARCH_TEXT; ?></p>

<?php

    // Start of Search Box Output

    require ( "includes/templates/inc-searchbox.php" );

     // End of Search Box Output

}

  }

?>

<br />

<p></p>

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,5k
×
×
  • Criar Novo...