asp禁止外部服务器提交表单到服务器
禁止站外提交表单的asp代码如下:
<%
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
response.write "<br><br><center><table border=1 cellpadding=20 bordercolor=black bgcolor=#EEEEEE width=450>"
response.write "<tr><td style="font:9pt Verdana" mce_style="font:9pt Verdana">" response.write "你提交的路径有误,禁止从站点外部提交数据请不要乱改参数!"
response.write "</td></tr></table></center>"
response.end
end if
%>
使用方法:
1. 将以上代码另存为checkpath.asp
2. 在遇到表单提交的页面引用此检测代码
<!--#include file="checkpath.asp"-->
相关文档:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Session.CodePage=65001%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- #include file="../configinc/conndb.asp"-->
<!--#include file="../configi ......
<%
'下面是最具技术含量的函数了,哈哈~
'增加数据库字段
function addziduan(ziduanming,ziduanleixing)
on error resume next
fldname = ziduanming
if ziduanleixing=1 or ziduanleixing=4 then
fldtype = "VarChar"
fldsize = 255
elseif ziduanleixing=2 or ziduanleixing=3 then
fldtyp ......
fix是bmp的一种衍生格式,可用于asp生成验证码图形。
一个例子:
1 图象绘制完成后,将文件存为24位位图格式的BMP图象文件。
2 去除前54Byte内容.
3 改名为BODY+数字.FIX
4 修改CHECKCODE.ASP,调用你新做的这个文件.
(checkcode.asp 负责生成和输出验证码 1309 byte,head.fix 是54byte的BMP头,body.fix 数字0~9 10 ......
俩函数搞定asp的orm映射
orm必须用到实体类,像C#这样的语言 写实体类挺痛苦的,除非用工具
而asp有个好处,因为他可以动态构建一个字符串并把此字符串动态解析为代码,也就是他的 execute 和 ExecuteGlobal 俩函数
下面这个函数是 实体类生成器 只要传入列名字符串就能生成 一个全局可用的类
'定义一个实体类
' ......
<% '---调用WebService 获取Exchange2007已知用户的邮件未读数
'---参数说明----
'url:webservice 的路径
'params:方法参数
'method:方法名称
'dataType:返回的数据类型
function webServices(url,params,method,dataType)
set objXML=Server.CreateObject("MSXML2.XMLHTTP")
objXML.open "post& ......