if not (rs.BOF or rs.eof) then
login="true"
Session("username"&sessionID) = Username
Session("password"& sessionID) = Password
‘Response.cookies(“username”)= Username
‘Response.cookies(“Password”)= Password
------------len.reg-----------------
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\扩展(&E)]
@="C:\Documents and Settings\Administrator\桌面\len.htm"
"contexts"=dword:00000004
-----------end----------------------
-----------len.htm------------------
’判断文件类型是否合格
Private Function CheckFileExt (fileEXT)
dim Forumupload
Forumupload="gif,jpg,bmp,jpeg"
Forumupload=split(Forumupload,",")
for i=0 to ubound(Forumupload)
if lcase(fileEXT)=lcase(trim(Forumupload(i))) then
CheckFileExt=true
exit Function
else
CheckFileExt=false
end if
next
End Function
‘验证文件内容的合法性
set MyFile = server.CreateObject ("Scripting.FileSystemObject")
set MyText = MyFile.OpenTextFile (sFile, 1) ’ 读取文本文件
sTextAll = lcase(MyText.ReadAll): MyText.close
’判断用户文件中的危险操作
sStr ="8 .getfolder .createfolder .deletefolder .createdirectory
.deletedirectory"
sStr = sStr & " .saveas wscript.shell script.encode"
sNoString = split(sStr," ")
for i = 1 to sNoString(0)
if instr(sTextAll, sNoString(i)) <> 0 then
sFile = Upl.Path & sFileSave: fs.DeleteFile sFile
Response.write "<center><br><big>"& sFileSave &"文件中含有与操作目录等有关的命令"&_
"<br><font color=red>"& mid(sNoString(i),2) &"</font>,为了安全原因,<b>不能上传。<b>"&_"</big></center></html>"
Response.end
end if
next
把他们加到你的上传程序里做一次验证,那么你的上传程序安全性将会大大提高.
什么?你还不放心?拿出杀手锏,请你的虚拟主机服务商来帮忙吧。登陆到服务器,将PROG ID 中的"shell.application"项和"shell.application.1"项改名或删除。再将”WSCRIPT.SHELL”项和”WSCRIPT.SHELL.1”这两项都要改名或删除。呵呵,我可以大胆的说,国内可能近半以上的虚拟主机都没改过。只能庆幸你们的用户很合作,否则……我删,我删,我删删删……