-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave.php
33 lines (29 loc) · 828 Bytes
/
save.php
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
<?php
require('verifco.php');
$retour = 'error';
if(connected()) {
if(check($_POST)) {
if(check($_POST['dir']) and check($_POST['content'])) {
$filename = $_SERVER['DOCUMENT_ROOT'] . sec($_POST['dir']);
$content = $_POST['content'];
if(file_exists($filename)) {
file_put_contents($filename, $content, LOCK_EX);
$retour = 'done';
} else {
http_response_code(404);
$retour = 'Cant find file';
}
} else {
http_response_code(400);
$retour = "No dir or content parameter";
}
} else {
http_response_code(400);
$retour = "No POST parameter";
}
} else {
http_response_code(403);
$retour = 'not connected';
}
echo $retour;
?>