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