峨眉山房产网
<% Set Conn=Server.CreateObject("ADODB.Connection") ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../../../../data/newhouse/newhouse.asp") Conn.Open connstr %> <% 'asp script On Error Resume Next 'Server.ScriptTimeOut=9999999 Function getHTTPPage(Path) t = GetBody(Path) 'getHTTPPage=BytesToBstr(t,"GB2312") getHTTPPage = t End function Function GetBody(url) on error resume next 'ServerURL="http://www.lsfdc.gov.cn/index.asp" Set Mail1 = Server.CreateObject("CDO.Message") Mail1.CreateMHTMLBody url,31 GetBody=Mail1.HTMLBody Set Mail1 = Nothing End Function Function BytesToBstr(body,Cset) dim objstream set objstream = Server.CreateObject("adodb.stream") objstream.Type = 1 objstream.Mode =3 objstream.Open objstream.Write body objstream.Position = 0 objstream.Type = 2 objstream.Charset = Cset BytesToBstr = objstream.ReadText objstream.Close set objstream = nothing End Function Function Newstring(wstr,strng) Newstring=Instr(lcase(wstr),lcase(strng)) if Newstring<=0 then Newstring=Len(wstr) End Function '生成抓取的信息 '##---------- 参数说明 ----------## '@url 源页面地址 '@beginlable 标签开始 '@endlable 标签结束 Function createParse(url,beginlable,endlable) on error resume next Dim wstr,str,start,over wstr = GetBody(url) start = Newstring(wstr,beginlable) + Len(beginlable) over = Newstring(wstr,endlable) body = mid(wstr,start,over - start) createParse = body End Function %> <% '========================= '函数名:HTMLEncode(fString) '参数:fString(字符串) '功能:将HTML编码,使之可以在HTML中安全显示 '=========================== function HTMLEncode(fString) if not isnull(fString) then fString = replace(fString, ">", ">") fString = replace(fString, "<", "<") fString = Replace(fString, CHR(32), " ") fString = Replace(fString, CHR(9), " ") fString = Replace(fString, CHR(34), """) fString = Replace(fString, CHR(39), "'") fString = Replace(fString, vbCrLf, "
") fString = Replace(fString, CHR(10) & CHR(10), "

") fString = Replace(fString, CHR(10), "
") HTMLEncode = fString end if end function '================================= '函数名:nohtml(str) '参数:str(字串) '功能:去除HTML标记,返回文本字串 '================================= function nohtml(str) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="(\<.[^\<]*\>)" str=re.replace(str," ") re.Pattern="(\<\/[^\<]*\>)" str=re.replace(str," ") nohtml=str set re=nothing end function '=============================== '函数名:HTMLcode(Content) '参数:字符串 '功能:返回HTML代码 '=============================== function HTMLcode(Content) if not isnull(Content) then Content = Replace(Content, " ","  ") Content = Replace(Content, ">", ">") Content = Replace(Content, "<", "<") Content = Replace(Content, "\", "\\") Content = Replace(Content, vbCrLf, "
") Content = Replace(Content, CHR(10), "
") Content = Replace(Content, CHR(34), """) Content = Replace(Content, CHR(39), "'") HTMLcode = Content end if end function '============================== '过程名:ShowMsg(Msg,URL) '参数:字串,要输出的参数;地址,如果为"BACK"则返回上一页 '功能:在客户端输出警告消息,跳转至URL '============================== Sub ShowMsg(Msg,URL) response.write "" & VbCRLF End Sub '=========================== '函数名:checkpost() '参数:无 '功能:判断是否为本站提交的url '返回值:如果为本站的返回为Ture,否则为Flase '============================ function checkpost() dim server_str1,server_str2 checkpost=false server_str1=cstr(request.servervariables("http_referer")) server_str2=cstr(request.servervariables("server_name")) if mid(server_str1,8,len(server_str2))=server_str2 then checkpost=True end if end function '=========================== '函数名:safestr(str) '参数:字符串 '功能:对STR进行过滤,去掉一些特殊符号,防止sql注射漏洞 '返回值:已过滤的字符串 '============================ function safestr(str) resultstr = replace(trim(str), "'", "") resultstr = replace(resultstr, ";", "") 'resultstr = replace(resultstr, "-", "") resultstr = replace(resultstr, "=", "") resultstr = replace(resultstr, "<", "") resultstr = replace(resultstr, ">", "") resultstr = replace(resultstr, "(", "") resultstr = replace(resultstr, ")", "") resultstr = replace(resultstr, "[", "") resultstr = replace(resultstr, "]", "") resultstr = replace(resultstr, " ", "") safestr = resultstr end function '=========================== '函数名:checksql(str) '参数:字符串 '功能:对STR进行过滤,去掉一些特殊符号,防止sql注射漏洞 '返回值:如果有为真,否则为假! '============================ function checksql(str) Badword="select∥update∥chr∥delete∥from∥;∥insert∥mid∥master.∥set" Chk_badword=split(Badword,"∥") checksql=False for i=0 to ubound(Chk_badword) If Instr(LCase(str),Chk_badword(i))<>0 Then checksql=True exit for end if next end function '=========================== '函数名:deletefile(filename) '参数:字符串 '功能:删除文件 '返回值:无 '============================ function deletefile(filename_str) filename=server.MapPath(filename_str) if filename<>"" then set fso=server.CreateObject("scripting.filesystemobject") if fso.FileExists(filename) then fso.DeleteFile filename end if set fso=nothing end if end function Function ToInt(a) If IsNumeric(a) Then ToInt=CLng(a) Else ToInt=0 End If End Function '======================================================= Function ToDbl(a) If IsNumeric(a) Then ToDbl=Cdbl(a) Else ToDbl=0 End If End Function '======================================================= Function GetRndFileName(sExt) Dim sRnd Randomize sRnd = Int(900 * Rnd) + 100 GetRndFileName = year(now) & month(now) & day(now) & hour(now) & minute(now) & second(now) & sRnd & "." & sExt End Function '=========================================================================== sub print(a,b,c) if a=b then response.write c end if end sub '============================================================================= '显示一个大类下的下类(下拉列表) '参数: 表单名一定要为editform 'default:默认选定值;upid:上一级类别代码(0代表大类);classtable:分类表 '============================================================================ function showclass(default,upid,classtable) opt="" checked="" upid=toint(upid) classtable=safestr(classtable) if classtable<>"" then opt="select * from " & classtable & " where upid=" & upid set rs1= Server.CreateObject("ADODB.Recordset") rs1.open opt,conn,1,1 opt="" do Until rs1.eof if rs1("id")=default then checked=" selected" else checked="" end if opt=opt&""&rs1("classname")&""&vbCrLf rs1.movenext loop rs1.close set rs1=nothing end if showclass=opt end function '=================================================== function classjava(classtable) tmpstr="" classtable=safestr(classtable) if classtable<>"" then set adors=server.createobject("adodb.recordset") tmpstr = "select * from "&classtable&" where upid<>0" adors.open tmpstr,conn,1,1 tmpstr="" tmpstr=tmpstr&" "&vbcrlf end if classjava=tmpstr end function Function Gettaxno(a) Set objRegExp = New RegExp a = Trim(a) a = Left(a, 15) a = UCase(a) objRegExp.Pattern = "\d{6}[A-Z0-9]{9}" objRegExp.IgnoreCase = True objRegExp.Global = True If objRegExp.Test(a) Then Gettaxno = a Else Gettaxno = "" End If End Function Function CStrDbl(a) If a > 0 And a < 1 Then CStrDbl = "0" & CStr(a) Else If a > -1 And a < 0 Then CStrDbl = "-0" & CStr(Abs(a)) Else CStrDbl = CStr(a) End If End If End Function %> <% mytable="Houseclass" '要操作的表 response.Write classjava(mytable) on error resume next%>

    楼盘搜索
       所在区域 ==>  物业类型 价格范围  属性  装修
关键字    

网站咨询电话:0833-2982371 联系邮箱:linf98@tom.com
Copyright © 2003 LSFC.net.cn All Rights Reserved.版权所有