<% Response.ContentType="text/vnd.wap.wml" %> <% ' 数据库连接 dim connstr1,conn1 const DB="xxx.mdb" '手机库路径 connstr1="DBQ="+server.mappath(""&DB&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" set conn1=server.createobject("ADODB.CONNECTION") conn1.open connstr1
'过滤非法字符function chk(str) if str<>"" then chktopic=replace(str,"'","''") end ifend function%><% '手机查询 if request.form("SJ")<>"" then d= chk(request.form("SJ")) '判断是否为数字或者大于7位的数字 if len(d)>=7 and IsNumeric(d) then c=left(d,7) '这里省略了很多代码sql="select * from mod where start<="&c&" and end>="&c&" and mid(start,3,1)="&mid(c,3,1)&" and mid(end,3,1)="&mid(c,3,1)&" and mid(start,4,1)="&mid(c,4,1)&" and mid(end,4,1)="&mid(c,4,1)&" and mid(start,5,1)="&mid(c,5,1)&" and mid(end,5,1)="&mid(c,5,1)&" and mid(start,6,1)="&mid(c,6,1)&" and mid(end,6,1)="&mid(c,6,1)&" " set rs=conn1.execute(sql) if not rs.eof then a=rs("city") b=rs("city1") e=rs("url") f=rs("thank") set rs=nothing else a="对不起,没有找到这个号码的纪录" end if else a="错误:请确保你输入的是大于7位的数字!" end if %>您搜索的手机号码: <%=d%> 所在地址:<%=a%> <%=b%> 区号和描述: <%=e%> <%=f%>