129 lines
5.1 KiB
Plaintext
129 lines
5.1 KiB
Plaintext
<HTML>
|
|
<HEAD>
|
|
<TITLE>Delete a File</TITLE>
|
|
<!-- This style creates the buttons For the script -->
|
|
<style>
|
|
<!--
|
|
body, td, li, p, table, Input
|
|
{
|
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
|
font-size: 8pt;
|
|
}
|
|
a:hover.Button
|
|
{
|
|
color: #FF0000;
|
|
background: #CCCCCC;
|
|
}
|
|
A.Button
|
|
{
|
|
Text-decoration: none;
|
|
color: #000000;
|
|
background: #CCCCCC;
|
|
}
|
|
.Button
|
|
{
|
|
Text-align: center;
|
|
Text-decoration: none;
|
|
color: #000000;
|
|
background: #CCCCCC;
|
|
border-top: 2px solid #EEEEEE;
|
|
border-Left: 2px solid #EEEEEE;
|
|
border-Right: 2px solid #999999;
|
|
border-bottom: 2px solid #999999;
|
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
|
font-size: 8pt;
|
|
padding-Left: 4;
|
|
padding-Right: 4;
|
|
padding-top: 2;
|
|
padding-bottom: 2;
|
|
}
|
|
-->
|
|
</style>
|
|
</HEAD>
|
|
|
|
<BODY>
|
|
|
|
<P align="center"><FONT size="6" color="#FF0000">File Deletion</FONT></P>
|
|
<%
|
|
strdelete = Request.QueryString("delete")
|
|
strFN = Request.QueryString("FN")
|
|
strFT = Request.QueryString("file")
|
|
'display the SHOW-ME-THE-FILE screen
|
|
If strdelete = "Show" Then
|
|
If strFT = "image" Then
|
|
Response.Write "<P align=center> <Img width=320 height=240 src=" & strFN & "><BR><BR>"
|
|
Response.Write "<A class=button href=default.asp?file=image&delete=Sure&FN=" & strFN & ">Delete?</A> "
|
|
Response.Write "<A class=button href=default.asp>List Files</A> <BR><BR></P>"
|
|
Else
|
|
Response.Write "<P align=center><FONT color=Blue size=5>" & strFN & "</FONT><BR><BR>"
|
|
Response.Write "<A class=button href=default.asp?file=file&delete=Sure&FN=" & strFN & ">Delete?</A> "
|
|
Response.Write "<A class=button href=default.asp>List Files</A> <BR><BR></P>"
|
|
End If
|
|
Response.End
|
|
End If
|
|
'display the ARE-YOU-SURE screen
|
|
If strdelete = "Sure" Then
|
|
If strFT = "image" Then
|
|
Response.Write "<P align=center> <Img width=320 height=240 src=" & strFN & "><BR><BR>"
|
|
Response.Write "<FONT color=Red size=5>Are You Sure You Want To Delete This File?</FONT><BR>"
|
|
Response.Write "<A class=button href=default.asp?delete=Yes&FN=" & strFN & ">Yes, Delete It.</A> "
|
|
Response.Write "<A class=button href=default.asp>NO, Do Not Delete It!</A> <BR><BR></P>"
|
|
Else
|
|
Response.Write "<P align=center><FONT color=Blue size=5>" & strFN & "</FONT><BR><BR>"
|
|
Response.Write "<FONT color=Red size=5>Are You Sure You Want To Delete This File?</FONT><BR>"
|
|
Response.Write "<A class=button href=default.asp?delete=Yes&FN=" & strFN & ">Yes, Delete It.</A> "
|
|
Response.Write "<A class=button href=default.asp>NO, Do Not Delete It!</A> <BR><BR></P>"
|
|
End If
|
|
Response.End
|
|
End If
|
|
'call the delete function
|
|
If strdelete = "Yes" Then
|
|
Call functionDF()
|
|
End If
|
|
|
|
'the delete function
|
|
Sub functionDF()
|
|
Dim fso, f1
|
|
Set fso = CreateObject("Scripting.FileSystemObject")
|
|
Set f1 = fso.GetFile(Server.MapPath(strFN))
|
|
f1.Delete
|
|
Response.Write "<P align=center>File <B>" & strFN & "</B> Deleted! <BR><BR>"
|
|
Response.Write "<A class=button href=default.asp>Return To List</A><BR></P>"
|
|
Response.End
|
|
End Sub
|
|
'view files in this directory
|
|
dirtowalk = "./"
|
|
|
|
'display the files
|
|
Set fs = CreateObject("Scripting.FileSystemObject")
|
|
Set f = fs.GetFolder(Server.MapPath(dirtowalk))
|
|
Set fc = f.Files
|
|
Response.Write "<HR>"
|
|
Response.Write "<P><FONT size=5 >File List</FONT></P> "
|
|
For Each tobdel In fc
|
|
|
|
'dont display this page
|
|
If tobdel.name = "default.asp" Then
|
|
Response.Write ""
|
|
'is the file an image?
|
|
ElseIf Right(tobdel.name, 4) = ".jpg" Then
|
|
Response.Write "<A class=button href=default.asp?file=image&delete=Show&FN=" & tobdel.name & "><I><B>View</B></I></A> "
|
|
Response.Write "<A class=button href=default.asp?file=image&delete=Sure&FN=" & tobdel.name & "><I><B>Del</B></I></A> " & tobdel.name & "<BR><BR>"
|
|
ElseIf Right(tobdel.name, 4) = ".gif" Then
|
|
Response.Write "<A class=button href=default.asp?file=image&delete=Show&FN=" & tobdel.name & "><I><B>View</B></I></A> "
|
|
Response.Write "<A class=button href=default.asp?file=image&delete=Sure&FN=" & tobdel.name & "><I><B>Del</B></I></A> " & tobdel.name & "<BR><BR>"
|
|
ElseIf Right(tobdel.name, 4) = "jpeg" Then
|
|
Response.Write "<A class=button href=default.asp?file=image&delete=Show&FN=" & tobdel.name & "><I><B>View</B></I></A> "
|
|
Response.Write "<A class=button href=default.asp?file=image&delete=Sure&FN=" & tobdel.name & "><I><B>Del</B></I></A> " & tobdel.name & "<BR><BR>"
|
|
'...or another file type
|
|
Else
|
|
Response.Write "<A class=button href=default.asp?file=file&delete=Show&FN=" & tobdel.name & "><I><B>View</B></I></A> "
|
|
Response.Write "<A class=button href=default.asp?file=file&delete=Sure&FN=" & tobdel.name & "><I><B>Del</B></I></A> " & tobdel.name & "<BR><BR>"
|
|
End If
|
|
Next
|
|
|
|
%>
|
|
</P>
|
|
|
|
</BODY>
|
|
</HTML> |