5D艺术网首页
商城
|
资讯
|
作品
|
博客
|
教程
|
论坛
登录
注册
加为好友
发短消息
来自:
性别:秘密
最后登录:2008-10-28
http://kafeichong.5d.cn/
首页
|
新闻
|
话题
|
博客
|
相册
|
艺术作品
|
社交关系
|
留言板
|
社交圈
2005/03/26 | [asp]禁止站外提交表单
类别(asp)
|
评论
(0)
|
阅读(46)
|
发表于 02:18
使用asp尽量减少服务器端的工作量,这样就应该多使用javascript,把所有提交字段使用javascript或vbscript检测后提交给服务器,这样服务器就不必再作检测,而在提交时可能会有人修改script从本地提交,这样存在安全提交的问题,所以应该要求从服务器断路径提交,其他地址提交提交无无效:
<%
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'>"
response.write "你提交的路径有误,禁止从站点外部提交数据请不要乱该参数!"
response.write "</td></tr></table></center>"
response.end
end if
%>
比如说上面的代码起名为check_path.asp保存,每次遇到表格提交时引用就行了:
<!--#include file="check_path.asp"-->
0
评论
Comments
日志分类
首页
[223]
javascript
[29]
asp
[62]
常识
[12]
SQL
[8]
文学
[2]
Dreamweaver
[22]
网页设计
[25]
flash
[20]
片言碎语
[21]
php
[6]
web standard
[16]