· 5 years ago · Feb 03, 2020, 07:48 AM
1<?php
2$secret_key = "n2b7nNzL"; //Set this as your secret key, to prevent others uploading to your server.
3$sharexdir = "sharex"; //This is your file dir, also the link..
4$domain_url = 'http://niggą.com/';
5$lengthofstring = 5; //Length of the file name
6
7function RandomString($length) {
8 $keys = array_merge(range(0,9), range('a', 'z'));
9
10 $key = '';
11 for($i=0; $i < $length; $i++) {
12 $key .= $keys[mt_rand(0, count($keys) - 1)];
13 }
14 return $key;
15}
16
17if(isset($_POST['secret']))
18{
19 if($_POST['secret'] == $secret_key)
20 {
21 $filename = RandomString($lengthofstring);
22 $target_file = $_FILES["sharex"]["name"];
23 $fileType = pathinfo($target_file, PATHINFO_EXTENSION);
24
25 if (move_uploaded_file($_FILES["sharex"]["tmp_name"], $sharexdir.$filename.'.'.$fileType))
26 {
27 echo $domain_url.$sharexdir.$filename.'.'.$fileType;
28 }
29 else
30 {
31 echo 'File upload failed - CHMOD/Folder doesn\'t exist?';
32 }
33 }
34 else
35 {
36 echo 'Invalid Secret Key';
37 }
38}
39else
40{
41 echo 'No post data recieved';
42}
43?>