请教个问题。谢谢了。

loooklook 2012-02-22 11:48:06
<%
Function GetURL(URL)
Set http=Server.CreateObject("Microsoft.XMLHTTP")
On Error Resume Next
http.Open "GET",URL,False
http.send()
if Err then
Err.Clear
Response.Write "<script>alert('没有找到网页,请返回后重试.');location=document.location+'';</script>"
Response.End()
End if
getHTTPPage=bytesToBSTR(Http.responseBody,"gb2312")
set http=nothing
GetURL=getHTTPPage
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
If(request("Send")="up") Then
If(request("URLSTR")<>"") Then
Content = GetURL(request("URLSTR"))
If(InstrRev(Content,"http://127.0.0.1")>0) Then '这里就是你网站的网址
Response.Write "<script>alert('可以添加');location='1.html';</script>"
Else
Response.Write "<script>alert('请先在您的首页加上我们的友情连接.');</script>"
End If
End If
End If
%>
<style type="text/css">
<!--
body,td,th,div,span,input,select,textarea,p {
font-family: 微软雅黑;
font-size: 12px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a:link {
color: #000000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
-->
</style>
<FORM METHOD=POST ACTION="">
<input type=text name="URLSTR"><input type=submit value="检测连接">
<input type=hidden name="Send" value="up">
</FORM>

这是个验证对方网站是否有本站友情链接。上面有个这个代码
If(InstrRev(Content,"http://127.0.0.1")>0) Then '这里就是你网站的网址
Response.Write "<script>alert('可以添加');location='1.html';</script>"
就是对方网站加上http://127.0.0.1链接就能跳转。可是。在检测输入框中直接填写http://127.0.0.1这个网址也能跳转。就是别人不做链接也能打开'1.html'这个页面。
有那位朋友可以添加一个。检测功能。当输入的网址和您的网站地址一样的时候就有提示不能跳转。输入已做链接的网站就可以继续下面的代码。
...全文
38 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧