-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsave3.php
More file actions
executable file
·53 lines (44 loc) · 979 Bytes
/
Copy pathsave3.php
File metadata and controls
executable file
·53 lines (44 loc) · 979 Bytes
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
49
50
51
52
53
<?php
/*Used for uploading files and projects
X-PETC-A: token
X-PETC-B: filename
X-PETC-C: unk, 0 works
X-PETC-D: filesize
X-PETC-E: region
file contents in body of request as chunked data
*/
include "functions.php";
init(false);
if(!isset($h["X-PETC-B"])){
die();
}
if(!isset($h["X-PETC-D"])){
die();
}
$filename=$h["X-PETC-B"];
$size=$h["X-PETC-D"];
//generate a key
do{
$key="0";
$lower=[48,65];
$upper=[57,90];
$len=rand(3,8);
for($s=0;$s<$len+1;$s=$s+1){
$chartype=rand(0,1);
$key.=chr(rand($lower[$chartype],$upper[$chartype]));
}
}while(file_exists($key));
mkdir($key);
file_put_contents("$key/raw",file_get_contents("php://input"));
file_put_contents("$key/about",
"ID: $id\n".
"Filename: $filename"
);
header("X-Petc-Pubkey: $key");
header("X-Petc-UID: 0");
header("X-Petc-Rights: 1");
header("X-Petc-FileCount: 0");
header("X-Petc-MaxCount: 100");
header("X-Petc-FileSize: ".filesize("$key/raw"));
header("X-Petc-MaxSize: 134217728");
echo("OK");