· 9 years ago · Sep 21, 2016, 06:26 PM
1<?php
2$secret_key = "ayylmaolololorofl";
3$sharexdir = "i/";
4$domain_url = 'http://nico.ruoste.net/';
5$lengthofstring = 5;
6
7function RandomString($length) {
8 $keys = array_merge(range(0,9), range('a', 'z'));
9
10 for($i=0; $i < $length; $i++) {
11 $key .= $keys[mt_rand(0, count($keys) - 1)];
12 }
13 return $key;
14}
15
16if(isset($_POST['secret']))
17{
18 if($_POST['secret'] == $secret_key)
19 {
20 $filename = RandomString($lengthofstring);
21 $target_file = $_FILES["sharex"]["name"];
22 $fileType = pathinfo($target_file, PATHINFO_EXTENSION);
23
24 if (move_uploaded_file($_FILES["sharex"]["tmp_name"], $sharexdir.$filename.'.'.$fileType))
25 {
26 echo $domain_url.$sharexdir.$filename.'.'.$fileType;
27 }
28 else
29 {
30 echo 'File upload failed - CHMOD/Folder doesn\'t exist?';
31 }
32 }
33 else
34 {
35 echo 'Invalid Secret Key';
36 }
37}
38else { echo 'E voi mitta =('; }
39?>