易截截图软件、单文件、免安装、纯绿色、仅160KB

防止SQL注入完整ASP代码

<%
Dim Fy_Url,Fy_a,Fy_x,Fy_Cs(),Fy_Cl,Fy_Ts,Fy_Zx
'---定义部份   头------
Fy_Cl = 1   '处理方式:1=提示信息,2=转向页面,3=先提示再转向
Fy_Zx = "Error.Asp" '出错时转向的页面
'---定义部份   尾------
On Error Resume Next
Fy_Url=Request.ServerVariables("QUERY_STRING")
Fy_a=split(Fy_Url,"&")
redim Fy_Cs(ubound(Fy_a))
On Error Resume Next
for Fy_x=0 to ubound(Fy_a)
Fy_Cs(Fy_x) = left(Fy_a(Fy_x),instr(Fy_a(Fy_x),"=")-1)
Next
For Fy_x=0 to ubound(Fy_Cs)
If Fy_Cs(Fy_x)<>"" Then
   If Instr(LCase(Request(Fy_Cs(Fy_x))),"'")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"and")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"select")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"update")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"chr")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"delete%20from")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),";")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"insert")<>0 or Instr(LCase(Request(Fy_Cs(Fy_x))),"mid")<>0 Or Instr(LCase(Request(Fy_Cs(Fy_x))),"master.")<>0 Then
   Select Case Fy_Cl
     Case "1"
   Response.Write "<Script Language=JavaScript>alert('                    出现错误!参数 "&Fy_Cs(Fy_x)&" 的值中包含非法字符串!\n\n   请不要在参数中出现:;,and,select,update,insert,delete,chr 等非法字符!\n\nSQL通用防注入V1.0 ASP版 -- :;window.close();');window.close();</Script>"
     Case "2"
   Response.Write "<Script Language=JavaScript>location.href='"&Fy_Zx&"'</Script>"
     Case "3"
   Response.Write "<Script Language=JavaScript>alert('                    出现错误!参数 "&Fy


相关文档:

使用SQLServer模板来写规范的SQL语句

如果你经常遇到下面的问题,你就要考虑使用SQL Server的模板来写规范的SQL语句了:
SQL初学者。
经常忘记常用的DML或是DDL SQL 语句。
在多人开发维护的SQL中,每个人都有自己的SQL习惯,没有一套统一的规范。
在SQL Server Management Studio中,已经给大家提供了很多常用的现成SQL规范模板。
SQL Server Management ......

维护SQL server的28个小问题

1.如何创建数据库
CREATE DATABASE student
2.如何删除数据库
DROP DATABASE student
3.如何备份数据库到磁盘文件
BACKUP DATABASE student to disk=´c:S4.bak´
4.如何从磁盘文件还原数据库
RESTORE DATABASE studnet from DISK = ´c:S4.bak´
5.怎样创建表?
CREATE TABLE Students (
&n ......

一个sql简单函数实现拼接字符串

--测试数据
create table table1(AID int,NAME nvarchar(20))
create table table2 (BID int,NUMBER nvarchar(20))
insert into table1 select 1,'Tom' union all
select 2,'Jim'
insert into table2 select 1,20 union all
select 1,30
--函数
create function F_Str(@ID int)
returns nvarchar(100)
as
begin ......

sql总结

1.创建数据库
    --exec xp_cmdshell 'mkdir d:\project'--调用DOS命令创建文件夹,使用此句需要启动SQL的外围工具
    if exists(select * from sysdatabases where name='数据库名')
     drop database 数据库名
    set nocount on   ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号