-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
79 lines (45 loc) · 1.26 KB
/
index.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/////////
// GET //
/////////
$image = $_GET["image"];
if ($image != null && $image != "")
{
//////////////
// CHECKING //
//////////////
$image_decoded = urldecode($image);
$pattern = "/<svg\b[^>]*>.*?<\/svg>/is";
if (preg_match($pattern, $image_decoded))
{
////////////
// UPLOAD //
////////////
$filetype = "image/svg+xml";
$fileraw = base64_encode($image_decoded);
$filename = hash('md5', time());
$filesize = strlen($image_decoded);
$filebody = "data:" . $filetype . ";base64," . $fileraw;
//////////////
// DOWNLOAD //
//////////////
header("Content-Description: File Transfer");
header("Content-Type: $filetype");
header("Content-Disposition: attachment; filename=$filename");
header("Expires: 0");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: public");
header("Content-Length: $filesize");
header("Content-Transfer-Encoding: binary");
readfile($filebody);
};
}
else
{
echo "This is <a href='https://github.com/ddan9/get2pic'>get2pic</a> service. You need to check the <a href='https://github.com/ddan9/get2pic'>sources</a> on GitHub for understanding how to use it!";
};
////////////
// ENDING //
////////////
exit();
?>