您还不是vip会员或者没有登录,无法进入学习,请登录后访问或者联系站长升级会员等级!
为了能给大家提供更好的服务和视频教程,本站VIP课程需要收取一定的学费,具体收费标准根据不同的班级课程和有效期长短有所不同,具体请咨询在线老师,多谢您对本站的支持!
asp编程13—asp获取ip地址并替换为星号实例
讲师:瑞德威(赵老师)
asp动态网站开发 视频教程
第八课 asp数组的使用
6、数组应用实例:如何获取ip地址,并隐藏最后一位数字
<h3>作业实例:asp获取真实ip地址</h3>
< %
function getip()
dim dulip,proip
dulip=request.servervariables("http_x_forwarded_for")
proip=request.servervariables("remote_addr")
if dulip="" then
getip=proip
else
getip=dulip
end if
end function
dim trueip,iparray,url1,url2
trueip=getip()
iparray=split(trueip,".")
’分割ip到数组
response.write(trueip&"<br>")
response.write(iparray(0)&"."&iparray(1)&"."&iparray(2)&"."&"*"&"<br>")
’替换最后一个数字
’asp获取当前网页地址
url1 = request.servervariables("http_host")
’asp获取来源网页地址
url2 = request.servervariables("http_referer")
response.write(url1&"<br>"&url2)
%>
上一讲:asp编程12—asp数组的使用方法 | 下一讲:asp编程14—if条件判断语句的用法
![]() |
豫公网安备 41010202002486号 | ICP备案:豫ICP备18044432号-1 |