-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDelete_Temporary_Files.php
More file actions
executable file
·48 lines (45 loc) · 2.13 KB
/
Delete_Temporary_Files.php
File metadata and controls
executable file
·48 lines (45 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
################################################################################
# Program Name: Delete_Temporary_Files.php
# Description: Deletes temporary files created by LaTeX_Converter.pl.
# Usage: Delete_Temporary_Files.php?dir=name
# Causes directory "/temporary/name" and all of its contents to
# be deleted.
# History: v.1.0 written in 12/9/06 by Philip Stevenson (initial version)
#
# Copyright (C) 2007 Tyler A. Davis
# Copyright (C) 2007 Philip Stevenson
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
################################################################################
#Microsoft Word will not make the call to this PHP script if the URL has already
#been called since Word was started. This shouldn't be a problem, since the
#directory name should be unique each time a PNG is generated, but Word appears
#to apply its URL-checking incorrectly. The following line guarantees that this
#script will be called every time.
header("Cache-Control: no-cache, must-revalidate" );
#The name of the directory should only be a string of numbers. Return an error
#if any other argument is used or if the string is too short or too long.
$Directory_Name = $_GET['dir'];
if ( (preg_match('/\D/', $Directory_Name))
|| (strlen($Directory_Name) > 10)
|| (strlen($Directory_Name) < 1) )
{echo 'Invalid directory name.';}
else
{
system("rmdir \"./temporary/$Directory_Name\" /s /q");
}
# {system("rm -r temporary/$Directory_Name");}
?>