Advertisement
Guest User

Untitled

a guest
Jan 28th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <?php
  2. header("Content-Type: text/text");
  3.  
  4. function generateRandomString($length = 10) {
  5. $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  6. $charactersLength = strlen($characters);
  7. $randomString = '';
  8. for ($i = 0; $i < $length; $i++) {
  9. $randomString .= $characters[rand(0, $charactersLength - 1)];
  10. }
  11. return $randomString;
  12. }
  13.  
  14. $key = "CHANGEME;
  15. $uploadhost = "http://changeme.changeme/img/";
  16. $redirect = "http://changeme(homepage).in";
  17.  
  18. if (isset($_POST['k'])) {
  19. if ($_POST['k'] == $key) {
  20. $target = getcwd() . "/" . basename($_FILES['d']['name']);
  21. if (move_uploaded_file($_FILES['d']['tmp_name'], $target)) {
  22. $gay = generateRandomString(6);(getcwd() . "/" . basename($_FILES['d']['name']));
  23. rename(getcwd() . "/" . basename($_FILES['d']['name']), getcwd() . "/" . $gay . "." . end(explode(".", $_FILES["d"]["name"])));
  24. echo $uploadhost .$gay . "." . end(explode(".", $_FILES["d"]["name"]));
  25. } else {
  26. echo "Sorry, there was a problem uploading your file.";
  27. }
  28. } else {
  29. header('Location: '.$redirect);
  30. }
  31. } else {
  32. header('Location: '.$redirect);
  33. }
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement