A sudden inspiration that day, is aimed at the chain of anti-theft
Normal upload files, if the person hotlinking increased the burden of their own servers, the last 164.cc so was hung
Then think of countermeasures, the current types of anti-theft chain procedures are also many, but the use is not simple, there is no free ...
So, you have to think first. Well, now look at the title, and then think about the chain of anti-theft, perhaps some of the figure
I can change the upload file is the name of the folder, and this site program is dynamically obtained folder name, so that the original site files stolen from the location of the file will be due to the path of error can not find files, thus realizing the anti-theft chain.
So, how do I use the FSO to modify the name of a folder?
A simple function:
Copy Code code as follows:
<%
Function Fldrename (NOWFLD,NEWFLD)
Nowfld=server.mappath (NOWFLD)
Newfld=server.mappath (NEWFLD)
Set fso = CreateObject ("Scripting.FileSystemObject")
If not FSO. FolderExists (NOWFLD) Then
Response.Write ("The folder path you want to modify is incorrect or the folder name is entered incorrectly")
Else
Fso. CopyFolder NOWFLD,NEWFLD
Fso. DeleteFolder (NOWFLD)
End If
Set fso=nothing
End Function
%>
In general, copy the contents of the current folder into a new folder, and then delete the contents of the folder, which indirectly achieves the purpose of renaming the folder.
This is a paranoid problem because changing the name of a folder, especially when the folder content is G-volume, is a bit of a bargain relative to the FTP remote modification name.
Some people say that FSO can directly modify the folder name? Goumo.
Apply this function
<%call fldrename ("ex01", "ex02")%>
The basic meaning is about to modify the EX01 folder name in the same directory as the program execution file to ex02
Here is my local test bulletin:
1, this program does not consume program execution time
2, the implementation of 1G folder indirect renaming time needs about 50 seconds, in fact, is the server-side file replication transfer time
3,CPU consumption is not too high, about 30%
4, if the change in the middle of a sudden crash or power off, then two kinds of situations occur:
A, the new folder was built early (the new folder was not built), and the next time the program was executed, an error type occurred: the Microsoft VBScript run-time error (0x800a003a) file already exists. Only FTP can be removed from the new folder at this time (trying to remove the new folder using the FSO does not work).
b, some files have been copied, the next execution of the program, automatically overwriting the copied folder contents, the original folder content remains. The original folder and its files will not be deleted until the copy is complete.
5, also need to pay attention to the name of the new folder, avoid and existing folder name duplicate, of course, can also be judged by the program
Copy Code code as follows:
<%
Function Fldrename (NOWFLD,NEWFLD)
Nowfld=server.mappath (NOWFLD)
Newfld=server.mappath (NEWFLD)
Set fso = CreateObject ("Scripting.FileSystemObject")
If not FSO. FolderExists (NOWFLD) Then
Response.Write ("The folder path you want to modify is incorrect or the folder name is entered incorrectly")
Else
If FSO. FolderExists (NEWFLD) Then
Response.Write ("The new folder name you named already exists")
Else
Fso. CopyFolder NOWFLD,NEWFLD
Fso. DeleteFolder (NOWFLD)
End If
End If
Set fso=nothing
End Function
%>
6, if you modify the folder name while the folder has database-related operations, music files are being played, the Microsoft VBScript run-time error (0x800A0046) appears to have no permissions, mainly to delete the existing folder problems (music files have been deleted, However, the folder could not be deleted. Only the FTP login is processed. If this folder is a full picture file, you can run successfully.