当前位置: 移动技术网 > IT编程>开发语言>Asp > 高手推荐的比较有用的ASP函数集合

高手推荐的比较有用的ASP函数集合

2017年12月12日  | 移动技术网IT编程  | 我要评论
现在不写asp了,这次我将我以前沉淀下的一些函数库共享给大家,希望能给初学者启示,给老手也有所帮助吧,先谢谢大家支持!
<%@language="vbscript" codepage="936"%>
<% 
starttime=timer() '程序执行时间检测
'###############################################################
'┌──vibo───────────────────┐
'│             vibo studio 版权所有             │
'└───────────────────────┘
' author:vibo 
' email:vibo_cn@hotmail.com
'----------------- vibo asp站点开发常用函数库 ------------------
'opendb(vdata_url)   -------------------- 打开数据库
'getip()  ------------------------------- 得到真实ip
'getipadress(sip)------------------------ 查找ip对应的真实地址
'ip2num(sip) ---------------------------- 限制某段ip地址
'chkfrom() ------------------------------ 防站外提交设定
'getsys() ------------------------------- 操作系统检测
'getbrowser() --------------------------- 浏览器版本检测
'getsearcher() -------------------------- 识别搜索引擎
'
'---------------------- 数据过滤 ↓----------------------------
'checkstr(byval chkstr) ----------------- 检查无效字符
'checksql() ----------------------------- 防止sql注入
'uncheckstr(str)------------------------- 检查非法sql命令
'checkstr(str) -------------------------- asp最新sql防注入过滤涵数
'htmlencode(restring) ------------------- 过滤转换html代码
'datetostr(datetime,showtype) ----------- 日期转换函数
'date2chinese(idate) -------------------- 获得asp的中文日期字符串
'lenstr(str) ---------------------------- 计算字符串长度(字节)
'createarr(str) ------------------------- 生成二维数组
'showrsarr(rsarr) ----------------------- 用表格显示记录集getrows生成的数组的表结构
'---------------------- 外接组件使用函数↓------------------------
'sendmail(to_email,from_email,from_name,mail_subject,mail_body,mail_htmlbody) -----'jmail组件 发送邮件
'-----------------------------------------系统检测函数↓------------------------------------------
'isvalidurl(url) ------------------------ 检测网页是否有效
'gethtmlpage(filename) ------------------ 获取文件内容
'checkfile(filepath) -------------------- 检查某一文件是否存在
'checkdir(folderpath) ------------------- 检查某一目录是否存在
'makenewsdir(foldername) ---------------- 根据指定名称生成目录
'createhtmlpage(filename,filedata,c_mode) 生成文件
'checkbadword(byval chkstr) ------------- 过滤脏字
'###############################################################
dim ipdata_url
ipdata_url="./ip.mdb"
response.write("--------------客户端信息检测------------"&"<br>")
response.write(getsys()&"<br>")
response.write(getbrowser()&"<br>")
response.write(getsearcher()&"<br>")
response.write("ip:"&getip()&"<br>")
response.write("来源:"&(getipadress(getip()))&"<br>")
response.write("<br>")
response.write("--------------数据提交检测--------------"&"<br>")
if not chkfrom then
    response.write("请不要从站外提交内容!"&"<br>")
    response.end
else
    response.write("本站提交内容!"&"<br><br>")
end if
function opendb(vdata_url)
'------------------------------打开数据库
'使用:conn = opendb("data/data.mdb")
  dim vibo_conn
  set vibo_conn= server.createobject("adodb.connection")
  vibo_conn.connectionstring="provider=microsoft.jet.oledb.4.0;data source=" & server.mappath(vdata_url)
  vibo_conn.open
  opendb=vibo_conn
end function
function getip()
'-----------------------得到真实ip
userip = request.servervariables("http_x_forwarded_for") 
if userip = "" then userip = request.servervariables("remote_addr") 
getip=userip
end function

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网