• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >ASP > 一些值得一看的代码asp

一些值得一看的代码asp

作者: 字体:[增加 减小] 来源:互联网 时间:2017-05-11

通过本文主要向大家介绍了asp源代码,asp代码,asp登录界面代码,asp代码大全,asp跳转页面代码等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
Asp中对ip进行过滤限制函数
<%
'获取访问者的地址
ip=Request.ServerVariables("REMOTE_ADDR")
'允许的IP地址段为10.0.0.0~10.68.63.255
allowip1="10.0.0.0"
allowip2="10.68.10.71"
response.write checkip(ip,allowip1,allowip2)
function checkip(ip,allowip1,allowip2)
dim check(4)
checkip=false
ipstr=split(ip,".")
allow1=split(allowip1,".")
allow2=split(allowip2,".")
if cint(allow1(0))>cint(allow2(0)) then
'判断IP地址段是否合法
response.write "IP地址段出错!"
exit function
end if
for i=0 to ubound(ipstr)
if cint(allow1(i))<cint(allow2(i)) then
if cint(allow1(i))=cint(ipstr(i)) then
check(i)=true
checkip=true
exit for
elseif cint(ipstr(i))<cint(allow2(i)) then
check(i)=true
checkip=true
exit for
elseif cint(ipstr(i))>cint(allow2(i)) then
check(i)=false
checkip=false
exit for
else
check(i)=true
checkip=true
end if
end if
end if
elseif cint(allow1(i))>cint(ipstr(i)) or cint(allow1(i))<cint(ipstr(i)) then
check(i)=false
checkip=false
if i<>ubound(ipstr) then
exit for
end if
else
check(i)=true
end if
end if
next
if (check(0)=true and check(1)=true and check(2)=true and check(3)=false) and (cint(allow2(2))>cint(ipstr(2))) then
checkip=true
end if
end function
%>


<%
'列举使用HTML表单提交的所有值
For Each item In Request.Form
     Response.Write Request.Form(item)
Next
%>
列举使用HTML表单提交的所有值 

利用ASP得到图片尺寸大小 
<%  
imgpath="default_22.gif"

set  pp=new  imgInfo  
w = pp.imgW(server.mappath(imgpath))  
h = pp.imgH(server.mappath(imgpath)) 
set pp=nothing 

response.write "<img src='"&imgpath&"' border=0><br>宽:"&w&";高:"&h


Class  imgInfo  
dim  aso  
Private  Sub  Class_Initialize  
   set  aso=CreateObject("Adodb.Stream")  
   aso.Mode=3    
   aso.Type=1    
   aso.Open    
End  Sub  
Private  Sub  Class_Terminate
   err.clear
   set  aso=nothing  
End  Sub  

Private  Function  Bin2Str(Bin)  
   Dim  I,  Str  
   For  I=1  to  LenB(Bin)  
     clow=MidB(Bin,I,1)  
     if  ASCB(clow)<128  then  
       Str  =  Str  &  Chr(ASCB(clow))  
     else  
       I=I+1  
       if  I  <=  LenB(Bin)  then  Str  =  Str  &  Chr(ASCW(MidB(Bin,I,1)&clow))  
     end  if  
   Next    
   Bin2Str  =  Str  
End  Function  

Private  Function  Num2Str(num,base,lens)  
   dim  ret  
   ret  =  ""  
   while(num>=base)  
     ret  =  (num  mod  base)  &  ret  
     num  =  (num  -  num  mod  base)/base  
   wend  
   Num2Str  =  right(string(lens,"0")  &  num  &  ret,lens)  
End  Function  

Private  Function  Str2Num(str,base)  
   dim  ret  
   ret  =  0  
   for  i=1  to  len(str)  
     ret  =  ret  *base  +  cint(mid(str,i,1))  
   next  
   Str2Num=ret  
End  Function  

Private  Function  BinVal(bin)  
   dim  ret  
   ret  =  0  
   for  i  =  lenb(bin)  to  1  step  -1  
     ret  =  ret  *256  +  ascb(midb(bin,i,1))  
   next  
   BinVal=ret  
End  Function  

Private  Function  BinVal2(bin)  
   dim  ret  
   ret  =  0  
   for  i  =  1  to  lenb(bin)  
     ret  =  ret  *256  +  ascb(midb(bin,i,1))  
   next  
   BinVal2=ret  
End  Function  

Private  Function  getImageSize(filespec)    
   dim  ret(3)  
   aso.LoadFromFile(filespec)  
   bFlag=aso.read(3)  
   select  case  hex(binVal(bFlag))  
   case  "4E5089":  
     aso.read(15)  
     ret(0)="PNG"  
     ret(1)=BinVal2(aso.read(2))  
     aso.read(2)  
     ret(2)=BinVal2(aso.read(2))  
   case  "464947":  
     aso.read(3)  
     ret(0)="GIF"  
     ret(1)=BinVal(aso.read(2))  
     ret(2)=BinVal(aso.read(2))  
   case  "535746":  
     aso.read(5)  
     binData=aso.Read(1)  
     sConv=Num2Str(ascb(binData),2  ,8)  
     nBits=Str2Num(left(sConv,5),2)  
     sConv=mid(sConv,6)  
     while(len(sConv)<nBits*4) &nb
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • asp批量添加修改删除操作示例代码
  • ASP常用源代码的总结(下)
  • ASP常用源代码的总结(上)
  • ASP替换、保存远程图片实现代码
  • asp获得浏览器agent信息代码
  • 较为全面的asp防CC攻击代码分享
  • asp 批量删除选中的多条记录的实现代码
  • asp中让function同时返回多个值的代码
  • asp google pr查询代码
  • ASP 自动采集实现代码

相关文章

  • 2017-05-11ASP 指南
  • 2017-05-11管理员登录
  • 2017-05-11突破空格的限制
  • 2017-05-11asp短信接口源码 比较简单但也挺实用用的(两个写法)
  • 2017-05-11雨哲防采集策略之列表篇
  • 2017-05-11ASP 常见的连接字符串写法(access2007)
  • 2017-05-11asp空间奸商查询系统
  • 2017-05-11代码与页面的分离
  • 2017-05-11在Win2003 64位下ASP无法连接Access数据库
  • 2017-05-11在线实时开通FTP&WEB

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • asp采集抓取网上房产信息的代码
    • asp下去除数组中重复项的方法
    • windows2003下使用asp WScript.Shell的设置方法
    • 使用asp代码突破图片的防盗连
    • asp中通过addnew添加内容后取得当前文章的自递增ID的方法
    • asp之GetArray提取链接地址,以$Array$分隔的代码
    • Asp 返回引用类型函数代码
    • ASP 操作cookies的方法
    • ASP程序代码执行时间统计类
    • 收集整理的ASP的常用内置函数

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有