· 6 years ago · Jul 13, 2019, 11:36 AM
1<?php
2
3$secret_key = "parolata"; //Set this as your secret key, to prevent others uploading to your server.
4$sharexdir = ""; //This is your file dir, also the link..
5$domain_url = 'aici pui url de la site cu tot cu https://';
6$lengthofstring = 8; //Length of the file name
7
8function RandomString($length) {
9 $keys = array_merge(range(0,9), range('a', 'z'));
10
11 $key = '';
12 for($i=0; $i < $length; $i++) {
13 $key .= $keys[mt_rand(0, count($keys) - 1)];
14 }
15 return $key;
16}
17
18if(isset($_POST['secret']))
19{
20 if($_POST['secret'] == $secret_key)
21 {
22 $filename = RandomString($lengthofstring);
23 $target_file = $_FILES["sharex"]["name"];
24 $fileType = pathinfo($target_file, PATHINFO_EXTENSION);
25
26 if (move_uploaded_file($_FILES["sharex"]["tmp_name"], $sharexdir.$filename.'.'.$fileType))
27 {
28 echo $domain_url.$sharexdir.$filename.'.'.$fileType;
29 }
30 else
31 {
32 echo 'File upload failed - CHMOD/Folder doesn\'t exist?';
33 }
34 }
35 else
36 {
37 echo 'Ai gresit parola baiatu meu hahahaha';
38 }
39}
40else
41{
42 echo 'Ce curios esti sa moara ma-ta.';
43}
44?>