ai Cara o script é longo olha só <%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True 'Turn buffering on
Response.Expires = -1 'Page expires immediately
'Constants
Const MIN_PAGESIZE = 10 'Minimum pagesize
Const MAX_PAGESIZE = 10 'Maximum pagesize
Const DEF_PAGESIZE = 10 'Default pagesize
'Variables
Dim objCn 'ADO DB connection object
Dim objRs 'ADO DB recordset object
Dim blnWhere 'True/False for have WHERE in sql already
Dim intRecord 'Current record for paging recordset
Dim intPage 'Requested page
Dim intPageSize 'Requested pagesize
Dim sql 'Dynamic sql query string
'Create objects
Set objCn = Server.CreateObject("ADODB.Connection")
Set objRs = Server.CreateObject("ADODB.Recordset")
'Set/initialize variables
intRecord = 1
blnWhere = False
'-Get/set requested page
intPage = MakeLong(Request("page"))
If intPage < 1 Then intPage = 1
'-Get/set requested pagesize
If IsEmpty(Request("pagesize")) Then 'Set to default
intPageSize = DEF_PAGESIZE
Else
intPageSize = MakeLong(Request("pagesize"))
'Make sure it fits our min/max requirements
If intPageSize < MIN_PAGESIZE Then
intPageSize = MIN_PAGESIZE
ElseIf intPageSize > MAX_PAGESIZE Then
intPageSize = MAX_PAGESIZE
End If
End If
'-Build dynamic sql
sql = "SELECT Principal.*, Quartos.*, Tiposdeimovel.*, BBarra.* FROM Quartos INNER JOIN (BBarra INNER JOIN (Tiposdeimovel INNER JOIN Principal ON Tiposdeimovel.ID = Principal.Category) ON BBarra.ID = Principal.Interest) ON Quartos.ID = Principal.State "
'--ID (exact search only)
If Not IsEmpty(Request("id")) Then
If IsNumeric(Request("id")) Then
blnWhere = True 'Set where to true
sql = sql & "WHERE "
sql = sql & "(Principal.ID = " & CStr(CLng(Request("id"))) & ") "
End If
End If
'--Category (exact search only)
If Not IsEmpty(Request("category")) Then
If IsNumeric(Request("category")) Then
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
sql = sql & "(Principal.Category = " & CStr(CLng(Request("category"))) & ") "
End If
End If
'--Interest (exact search only)
If Not IsEmpty(Request("interest")) Then
If IsNumeric(Request("interest")) Then
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
sql = sql & "(Principal.Interest = " & CStr(CLng(Request("interest"))) & ") "
End If
End If
'--State (exact search only)
If Not IsEmpty(Request("state")) Then
If IsNumeric(Request("state")) Then
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
sql = sql & "(Principal.State = " & CStr(CLng(Request("state"))) & ") "
End If
End If
'--Keyword (parital search only) search both title and __________DESCRICAO_______
If Not IsEmpty(Request("keyword")) Then
Dim strKeyword
strKeyword = Trim(Request("keyword"))
If strKeyword <> "" Then
'Test for WHERE
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
sql = sql & "(Principal.Title LIKE '%" & Replace(strKeyword, "'", "''") & "%' OR Principal.__________DESCRICAO_______ LIKE '%" & Replace(strKeyword, "'", "''") & "%') "
End If
End If
'--Price (minimum)
If Not IsEmpty(Request("minprice")) Then
If IsNumeric(Request("minprice")) Then
Dim dblMinPrice
dblMinPrice = CDbl(Request("minprice"))
'Test for WHERE
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
sql = sql & "(Principal.Price >= " & CStr(dblMinPrice) & ") "
End If
End If
'--Price (maximum)
If Not IsEmpty(Request("maxprice")) Then
If IsNumeric(Request("maxprice")) Then
Dim dblMaxPrice
dblMaxPrice = CDbl(Request("maxprice"))
'Test for WHERE
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
sql = sql & "(Principal.Price <= " & CStr(dblMaxPrice) & ") "
End If
End If
'--Show only records with picture
If (Request("pic")) = "ON" Then
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
sql = sql & " -- OR Picturelink = " & "''" & " "
End If
If blnWhere Then sql = sql & "AND " Else sql = sql & "WHERE " : blnWhere = True
sql = sql & "Principal.Random LIKE " & "0"
'--Sort By Field
sql = sql & " ORDER BY "
Select Case Trim(LCase(Request("sortby")))
Case "Data": sql = sql & "Principal.date "
Case "__________DESCRICAO_______": sql = sql & "Principal.__________DESCRICAO_______ "
Case "vaga": sql = sql & "Principal.vaga "
Case "price": sql = sql & "Principal.Price "
Case "image": sql = sql & "Principal.image "
Case "area": sql = sql & "Principal.area "
Case Else: sql = sql & "Principal.ID "
End Select
'--Sort Order
Select Case Trim(LCase(Request("sortorder")))
Case "asc": sql = sql & "ASC"
Case Else: sql = sql & "DESC"
End Select
'--Dynamic sql finished
'Create and open connection object
With objCn
.CursorLocation = adUseClient
.ConnectionTimeout = 15
.CommandTimeout = 30
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("busca.mdb") & ";"
.Open
End With
'Create and open recordset object
With objRs
.ActiveConnection = objCn
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.Source = sql
.PageSize = intPageSize
.Open
Set .ActiveConnection = Nothing 'Disconnect the recordset
End With
'Creates a long value from a variant, invalid always set to zero
Function MakeLong(ByVal varValue)
If IsNumeric(varValue) Then
MakeLong = CLng(varValue)
Else
MakeLong = 0
End If
End Function
'Returns a neatly made paging string, automatically configuring for request
'variables, regardless of in querystring or from form, adjust output to your needs.
Function Paging(ByVal intPage, ByVal intPageCount, ByVal intRecordCount)
Dim strQueryString
Dim strScript
Dim intStart
Dim intEnd
Dim strRet
Dim i
If intPage > intPageCount Then
intPage = intPageCount
ElseIf intPage < 1 Then
intPage = 1
End If
If intRecordCount = 0 Then
strRet = "No Records Found"
ElseIf intPageCount = 1 Then
strRet = "Atenção: Preços sujeitos a mudanças de acordo com o valor pedido pelo proprietário do imóvel."
Else
For i = 1 To Request.QueryString.Count
If LCase(Request.QueryString.Key(i)) <> "page" Then
strQueryString = strQueryString & "&"
strQueryString = strQueryString & Server.URLEncode(Request.QueryString.Key(i)) & "="
strQueryString = strQueryString & Server.URLEncode(Request.QueryString.Item(i))
End If
Next
For i = 1 To Request.Form.Count
If LCase(Request.Form.Key(i)) <> "page" Then
strQueryString = strQueryString & "&"
strQueryString = strQueryString & Server.URLEncode(Request.Form.Key(i)) & "="
strQueryString = strQueryString & Server.URLEncode(Request.Form.Item(i))
End If
Next
If Len(strQueryString) <> 0 Then
strQueryString = "?" & Mid(strQueryString, 2) & "&"
Else
strQueryString = "?"
End If
strScript = Request.ServerVariables("SCRIPT_NAME") & strQueryString
If intPage <= 10 Then
intStart = 1
Else
If (intPage Mod 10) = 0 Then
intStart = intPage - 9
Else
intStart = intPage - (intPage Mod 10) + 1
End If
End If
intEnd = intStart + 9
If intEnd > intPageCount Then intEnd = intPageCount
strRet = "Página " & intPage & " de " & intPageCount & ": "
If intPage <> 1 Then
strRet = strRet & "<a href=""" & strScript
strRet = strRet & "page=" & intPage - 1
strRet = strRet & """><<Anterior</a> "
End If
For i = intStart To intEnd
If i = intPage Then
strRet = strRet & "<b>" & i & "</b> "
Else
strRet = strRet & "<a href=""" & strScript
strRet = strRet & "page=" & i
strRet = strRet & """>" & i & "</a>"
If i <> intEnd Then strRet = strRet & " "
End If
Next
If intPage <> intPageCount Then
strRet = strRet & " <a href=""" & strScript
strRet = strRet & "page=" & intPage + 1
strRet = strRet & """>Próxima>></a> "
End If
End If
Paging = strRet
End Function
%><html>
<head>
<title>Luthero Rodrigues Imóveis</title>
<link rel="stylesheet" type="__________DESCRICAO_______/css" href="style.css">
<STYLE type=__________DESCRICAO_______/css>
.child {
DISPLAY: none
}
tr { background-color: #EFEFEF }
</STYLE>
<script language=JavaScript id=code>
<!--
function swapDisplay() {
// Make sure a child element exists
var child = event.srcElement.getAttribute("child");
if (null!=child) {
var el = document.all[child]
if (null!=el)
el.style.display = ""==el.style.display ? "block" : ""
}
}
document.onclick = swapDisplay;
// -->
</SCRIPT>
<script LANGUAGE="JavaScript">
<!-- Begin
function go(loc) {
window.location.href = loc;
}
// End -->
</script>
<STYLE type=__________DESCRICAO_______/javascript>
<!--
classes.child.ALL.display = "block"
// -->
</STYLE>
<meta http-equiv="Content-Type" content="__________DESCRICAO_______/html; charset=iso-8859-1">
<script language="JavaScript" type="__________DESCRICAO_______/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body link="#000000" onload="javascript: document.frmSearch.id.select();<%
if Request.Querystring("alert") = "yes" then%>
alert('An email has been sent to you.\nTo see your advertisment here, you simply need to check your mail and follow it´s instructions.\n\n Thank you very much for your advertisement!')<% end if%>">
<blockquote>
<blockquote>
<p><font face="Georgia, Times New Roman, Times, serif"><strong> <img src="img/asc.gif" width="13" height="12">
Preencha as opções de pesquisa abaixo, e Clique em Procurar:</strong></font></p>
</blockquote>
</blockquote>
<div align="center">
<center>
</center>
</div>
<div align="center">
<center>
<TABLE cellPadding=3 bordercolor="#FFFFFF" style="border-collapse: collapse" cellspacing="1" border="0" bgcolor="#FFFFFF" width="628">
<!--DWLayoutTable--><form name="frmSearch" method="post" action="default.asp">
<tr noWrap>
<td width="281" height="23" align="center" valign="top"><strong><font color="#000000">Tipo
de Imóvel:</font></strong></td>
<td width="178" align="center" valign="top"><strong><font color="#000000">Empreendimento:</font></strong></td>
<td width="147" align="center" valign="top"><strong><font color="#000000">Quartos:</font></strong></td>
</tr>
<tr noWrap>
<td height="36" align="center" valign="top"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<input type="hidden" name="page" value="1">
<input name="keyword" type="hidden" id="keyword3" value="<%=Server.HTMLEncode(Request("keyword"))%>">
<%
dim RS, Conn
SQL = "SELECT * FROM Tiposdeimovel "
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DBQ=" & Server.Mappath("busca.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open SQL, Conn
%>
<%If RS.EOF Then%>
<%Else%>
<select size="1" name="category">
<option value="" selected>Indefinido</option>
<%Do While Not RS.EOF%>
<option value="<%= RS("ID")%>" <% if Request("category")= ""&RS("ID")&"" then response.write "selected" end if%>><%= RS("Colcategory")%></option>
<% RS.MoveNext%>
<%Loop%>
</select>
<%end if
RS.Close
Set RS = Nothing
SQL = "SELECT * FROM BBarra "
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open SQL, Conn
If RS.EOF Then%>
<%Else
%>
</font></strong></td>
<td align="center" valign="top"> <p><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<select name="interest" size="1">
<option value="" selected>Indefinido</option>
<%Do While Not RS.EOF%>
<option value="<%= RS("ID")%>" <%= RS("ID")%>" <% if Request("interest")= ""&RS("ID")&"" then response.write "selected" end if%>><%= RS("Description")%></option>
<%
RS.MoveNext
Loop
%>
</select>
<%
end if
RS.Close
Set RS = Nothing
SQL = "SELECT * FROM Quartos "
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open SQL, Conn
If RS.EOF Then%>
<%Else%>
</font></strong></p></td>
<td align="center" valign="top"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<select size="1" name="state">
<option value="" selected>Indefinido</option>
<%Do While Not RS.EOF%>
<option value="<%= RS("ID")%>" <%= RS("ID")%>" <% if Request("state")= ""&RS("ID")&"" then response.write "selected" end if%>><%= RS("Colstate")%></option>
<%
RS.MoveNext
Loop
%>
</select>
<%end if%>
<%
RS.Close
Set RS = Nothing
Conn.Close
Set Conn = Nothing
%>
</font></strong></td>
</tr>
<tr noWrap>
<td height="22" align="center" valign="top"><strong><font size="2">Valor
Mínimo:
<input type="__________DESCRICAO_______" name="minprice" size="6" value="<%=Server.HTMLEncode(Request("minprice"))%>" style="font-size: 8pt">
</font></strong></td>
<td colspan="2" align="center" valign="top"><strong><font size="2">Valor
Máximo:
<input type="__________DESCRICAO_______" name="maxprice" size="6" value="<%=Server.HTMLEncode(Request("maxprice"))%>" style="font-size: 8pt">
</font></strong></td>
</tr>
<tr noWrap>
<td height="22" colspan="3" align="center" valign="top"><!--DWLayoutEmptyCell--> <form name="form1" method="post" action="default.asp">
<font size="1">
<input name="pagesize" type="hidden" id="pagesize" value="<%=intPageSize%>">
<input name="id" type="hidden" id="id" value="<%=Server.HTMLEncode(Request("id"))%>">
</font><font size="2">
<input name="btnSubmit" type="submit" id="btnSubmit3" value="Procurar">
</font>
</form>
<font size="2"> </font></td>
</tr>
<tr>
<td height="2" colspan="3"></td>
</tr></form>
</table>
</center>
</div>
<p align="center"> </p>
<p> </p>
</body></html><%
'Object cleanup
If IsObject(objRs) Then
If Not objRs Is Nothing Then
If objRs.State = adStateOpen Then objRs.Close
Set objRs = Nothing
End If
End If
If IsObject(objCn) Then
If Not objCn Is Nothing Then
If objCn.State = adStateOpen Then objCn.Close
Set objCn = Nothing
End If
End If
%> VALEU PESSOAL