corrade-http-templates – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | eva | 1 | <?php |
2 | |||
3 | ########################################################################### |
||
4 | ## Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 ## |
||
5 | ########################################################################### |
||
6 | ## A small script that will delete a conversation from the configured ## |
||
7 | ## conversation directory. ## |
||
8 | ########################################################################### |
||
9 | |||
10 | ########################################################################### |
||
11 | ## CONFIGURATION ## |
||
12 | ########################################################################### |
||
13 | |||
14 | require_once('config.php'); |
||
15 | require_once('functions.php'); |
||
16 | |||
17 | ########################################################################### |
||
18 | ## INTERNALS ## |
||
19 | ########################################################################### |
||
20 | # Bail if "firstname" or "lastname" are blank. |
||
21 | if(!isset($_POST['firstname']) || |
||
22 | !isset($_POST['lastname'])) return; |
||
23 | |||
24 | #### |
||
25 | # I. Get the path to the configured chat directory. |
||
26 | $chatPath = realpath($CHAT_DIRECTORY); |
||
27 | |||
28 | #### |
||
29 | # II. Get the user path. |
||
30 | $userPath = join( |
||
31 | DIRECTORY_SEPARATOR, |
||
32 | array( |
||
33 | $CHAT_DIRECTORY, |
||
34 | ucfirst( |
||
35 | strtolower( |
||
36 | $_POST['firstname'] |
||
37 | ) |
||
38 | ) .' '. |
||
39 | ucfirst( |
||
40 | strtolower( |
||
41 | $_POST['lastname'] |
||
42 | ) |
||
43 | ).'.log' |
||
44 | ) |
||
45 | ); |
||
46 | |||
47 | #### |
||
48 | # III. Check that the file will be placed within the chat directory. |
||
49 | $pathPart = pathinfo($userPath); |
||
50 | if(realpath($pathPart['dirname']) != $chatPath) |
||
51 | die; |
||
52 | |||
53 | #### |
||
54 | # IV. Remove the conversation. |
||
55 | unlink($userPath); |
||
56 | |||
57 | ?> |