<%
'某些网站为了安全,将FSO组件的名称进行更改以达到禁用FSO的目的。如果你的网站是这样做的,请在此输入更改过的名称。默认应为Scripting.FileSystemObject
my_fso="Scripting.FileSystemObject"
'====================================================================================
'生成文件夹子程序
sub add_myfso (wjj)
'创建 FileSystemObject 对象
Set fso=CreateObject(my_fso)
'映射虚拟路径到物理路径,得到如 d:\html
folder=Server.MapPath(wjj)
'检查文件夹物理路径,如果不存在则创建它
If fso.FolderExists(folder)=False Then
fso.CreateFolder(folder)
End If
set fso=nothing
end sub
'============================================================================
'生成文件子程序
sub add_wj_myfso (wjj,wj,wjnr)
'创建 FileSystemObject 对象
Set fso=CreateObject(my_fso)
'映射虚拟路径到物理路径,得到如 d:\html
folder=Server.MapPath(wjj)
'检查文件夹物理路径,如果不存在则创建它
If fso.FolderExists(folder)=False Then
fso.CreateFolder(folder)
End If
'指定被操作的文件
file=folder & "\" & wj
'重新创建文件,os为TextStream 对象
Set os=fso.CreateTextFile(file,True)
os.WrITeline wjnr
os.Close
set os=nothing
set fso=nothing
end sub
'============================================================================
'修改指定文件FSO子程序
sub xiu_wj_myfso(wjj,wj,wjnr)
'创建 FileSystemObject 对象
Set fso=CreateObject(my_fso)
'映射虚拟路径到物理路径,得到如 d:\html
folder=Server.MapPath(wjj)
'检查文件夹物理路径,如果不存在则创建它
If fso.FolderExists(folder)=False Then
fso.CreateFolder(folder)
End If
'指定被操作的文件
file=folder & "\" & wj
'重新创建文件,os为TextStream 对象
Set os=fso.CreateTextFile(file,True)
os.WrITeline wjnr
os.Close
set os=nothing
set fso=nothing
end sub
'============================================================================
'删除指定文件子程序
sub del_wj_myfso(wj)
wj= server.mappath(wj)
Set fso = Server.CreateObject(my_fso)
If fso.FileExists(wj) Then
fso.DeleteFile (wj),true
end if
Set fso = nothing
end sub
'============================================================================
'FSO安全修改说明
'我们可以做到禁止他人非法使用FileSystemObject对象,但是我们自己仍然可以使用这个对象.
'方法如下:查找注册表中
'HKEY_CLASSES_ROOT\Scripting.FileSystemObject 键值
'将其更改成为你想要的字符串(右键-->"重命名"),比如更改成为
'HKEY_CLASSES_ROOT\Scripting.FileSystemObject2
'这样,在ASP就必须这样引用这个对象了:
'Set fso = CreateObject("Scripting.FileSystemObject2")
'而不能使用:
'Set fso = CreateObject("Scripting.FileSystemObject")
'如果你使用通常的方法来调用FileSystemObject对象就会无法使用了。
'只要你不告诉别人这个更改过的对象名称,其他人是无法使用FileSystemObject对象的。这样,作为站点管理者我们就杜绝了他人非法使用FileSystemObject对象,而我们自己仍然可以使用这个对象来方便的实现网站在线管理等等功能了!
%>
'某些网站为了安全,将FSO组件的名称进行更改以达到禁用FSO的目的。如果你的网站是这样做的,请在此输入更改过的名称。默认应为Scripting.FileSystemObject
my_fso="Scripting.FileSystemObject"
'====================================================================================
'生成文件夹子程序
sub add_myfso (wjj)
'创建 FileSystemObject 对象
Set fso=CreateObject(my_fso)
'映射虚拟路径到物理路径,得到如 d:\html
folder=Server.MapPath(wjj)
'检查文件夹物理路径,如果不存在则创建它
If fso.FolderExists(folder)=False Then
fso.CreateFolder(folder)
End If
set fso=nothing
end sub
'============================================================================
'生成文件子程序
sub add_wj_myfso (wjj,wj,wjnr)
'创建 FileSystemObject 对象
Set fso=CreateObject(my_fso)
'映射虚拟路径到物理路径,得到如 d:\html
folder=Server.MapPath(wjj)
'检查文件夹物理路径,如果不存在则创建它
If fso.FolderExists(folder)=False Then
fso.CreateFolder(folder)
End If
'指定被操作的文件
file=folder & "\" & wj
'重新创建文件,os为TextStream 对象
Set os=fso.CreateTextFile(file,True)
os.WrITeline wjnr
os.Close
set os=nothing
set fso=nothing
end sub
'============================================================================
'修改指定文件FSO子程序
sub xiu_wj_myfso(wjj,wj,wjnr)
'创建 FileSystemObject 对象
Set fso=CreateObject(my_fso)
'映射虚拟路径到物理路径,得到如 d:\html
folder=Server.MapPath(wjj)
'检查文件夹物理路径,如果不存在则创建它
If fso.FolderExists(folder)=False Then
fso.CreateFolder(folder)
End If
'指定被操作的文件
file=folder & "\" & wj
'重新创建文件,os为TextStream 对象
Set os=fso.CreateTextFile(file,True)
os.WrITeline wjnr
os.Close
set os=nothing
set fso=nothing
end sub
'============================================================================
'删除指定文件子程序
sub del_wj_myfso(wj)
wj= server.mappath(wj)
Set fso = Server.CreateObject(my_fso)
If fso.FileExists(wj) Then
fso.DeleteFile (wj),true
end if
Set fso = nothing
end sub
'============================================================================
'FSO安全修改说明
'我们可以做到禁止他人非法使用FileSystemObject对象,但是我们自己仍然可以使用这个对象.
'方法如下:查找注册表中
'HKEY_CLASSES_ROOT\Scripting.FileSystemObject 键值
'将其更改成为你想要的字符串(右键-->"重命名"),比如更改成为
'HKEY_CLASSES_ROOT\Scripting.FileSystemObject2
'这样,在ASP就必须这样引用这个对象了:
'Set fso = CreateObject("Scripting.FileSystemObject2")
'而不能使用:
'Set fso = CreateObject("Scripting.FileSystemObject")
'如果你使用通常的方法来调用FileSystemObject对象就会无法使用了。
'只要你不告诉别人这个更改过的对象名称,其他人是无法使用FileSystemObject对象的。这样,作为站点管理者我们就杜绝了他人非法使用FileSystemObject对象,而我们自己仍然可以使用这个对象来方便的实现网站在线管理等等功能了!
%>