-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.php
202 lines (183 loc) · 9.3 KB
/
upload.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
function generateRandomString($length = 6) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
$result = "unknown";
$string = generateRandomString();
$target_dir = "up/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$temp = explode(".", $_FILES["fileToUpload"]["name"]);
$newfile = $string . '.' . end($temp);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
}
if ($_FILES["fileToUpload"]["size"] > 100000000) {
$result = "Sorry, your file is too large.";
$uploadOk = 0;
}
if($imageFileType != "mp4" && $imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "webp" && $imageFileType != "gif" ) {
$result = "Sorry, only JPG, JPEG, PNG, WEBP, GIF & MP4 files are allowed.";
$uploadOk = 0;
}
if ($uploadOk == 0) {
$result = "Sorry, your file was not uploaded.";
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_dir . $newfile)) {
if ($imageFileType == "mp4") {
if ($_POST['key'] == "sharex") {
echo "https://miraiscute.com/up/$newfile";
http_response_code(200);
return;
}
$result = "https://miraiscute.com/up/$newfile";
echo '<html>
<head>
<title> Mira | Image Uploader</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#EE82EE" />
<meta content="Mira | Image Uploader" property="og:title" />
<meta content="Image uploader made by Mira" property="og:description" />
<meta content="miraiscute.com" property="og:site_name" />
<meta
content="https://cdn.discordapp.com/attachments/873441703330185250/968450734175686666/flower-pot.png"
property="og:image"
/>
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="miraiscute.com" />
<meta name="twitter:creator" content="mira" />
<meta name="twitter:title" content="Mira | Image Uploader" />
<meta name="twitter:description" content="Image uploader made by Mira" />
<meta
name="twitter:image"
content="https://cdn.discordapp.com/attachments/873441703330185250/968450734175686666/flower-pot.png"
/>
<link rel="icon" type="image/png" sizes="32x32" href="flower-pot-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="flower-pot-16x16.png">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="h-14 bg-gradient-to-r from-purple-500 to-pink-500">
<nav
class="h-14 bg-gradient-to-r from-cyan-500 to-blue-500 relative w-full flex flex-wrap items-center justify-between py-3 bg-gray-100 text-gray-500 hover:text-gray-700 focus:text-gray-700 shadow-lg"
>
<div
class="container-fluid w-full flex flex-wrap items-center justify-between px-6"
>
<div class="container-fluid">
<a class="text-xl text-black font-semibold" href="/"
>File Uploader By Mira</a
>
</div>
</div>
</nav>
<div class="flex justify-center mt-3">
<label id ="copied">Click to copy:</label>
</div>
<div class="flex justify-center">
<button onclick="copy()" id="text" class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">'.$result.'</button>
</div>
<div class="flex justify-center">
<button class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline"><a href="/">Upload Another Image</a></button>
</div>
<script>
function copy() {
var myText = document.createElement("textarea")
myText.value = document.getElementById("text").innerHTML;
document.body.appendChild(myText)
myText.focus();
myText.select();
document.execCommand(\'copy\');
document.body.removeChild(myText);
document.getElementById("copied").innerHTML = "Copied!";
}
</script>
</body>
</html>
';
http_response_code(200);
} else {
if ($_POST['key'] == 'sharex') {
echo "https://miraiscute.com/$newfile";
http_response_code(200);
return;
}
$result = "https://miraiscute.com/$newfile";
echo '<html>
<head>
<title> Mira | Image Uploader</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#EE82EE" />
<meta content="Mira | Image Uploader" property="og:title" />
<meta content="Image uploader made by Mira" property="og:description" />
<meta content="miraiscute.com" property="og:site_name" />
<meta
content="https://cdn.discordapp.com/attachments/873441703330185250/968450734175686666/flower-pot.png"
property="og:image"
/>
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="miraiscute.com" />
<meta name="twitter:creator" content="mira" />
<meta name="twitter:title" content="Mira | Image Uploader" />
<meta name="twitter:description" content="Image uploader made by Mira" />
<meta
name="twitter:image"
content="https://cdn.discordapp.com/attachments/873441703330185250/968450734175686666/flower-pot.png"
/>
<link rel="icon" type="image/png" sizes="32x32" href="flower-pot-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="flower-pot-16x16.png">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="h-14 bg-gradient-to-r from-purple-500 to-pink-500">
<nav
class="h-14 bg-gradient-to-r from-cyan-500 to-blue-500 relative w-full flex flex-wrap items-center justify-between py-3 bg-gray-100 text-gray-500 hover:text-gray-700 focus:text-gray-700 shadow-lg"
>
<div
class="container-fluid w-full flex flex-wrap items-center justify-between px-6"
>
<div class="container-fluid">
<a class="text-xl text-black font-semibold" href="/"
>File Uploader By Mira</a
>
</div>
</div>
</nav>
<div class="flex justify-center mt-3">
<label id ="copied">Click to copy:</label>
</div>
<div class="flex justify-center mt-3">
<button onclick="copy()" id="text" class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline">'.$result.'</button>
</div>
<div class="flex justify-center mt-3">
<button class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline"><a href="/">Upload Another Image</a></button>
</div>
<script>
function copy() {
var myText = document.createElement("textarea")
myText.value = document.getElementById("text").innerHTML;
document.body.appendChild(myText)
myText.focus();
myText.select();
document.execCommand(\'copy\');
document.body.removeChild(myText);
document.getElementById("copied").innerHTML = "Copied!";
}
</script>
</body>
</html>
';
http_response_code(200);
}
} else {
$result = "Sorry, there was an error uploading your file.";
}
}
?>