Advertisement
Brandan

Untitled

Jul 16th, 2012
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2. include("/var/www/gameserverip.php");
  3. $ip = $_SERVER['REMOTE_ADDR'];
  4.  
  5. if ($ip == $localserver) {
  6.   $upload_dir = '/var/www/';
  7.   if (isset($_FILES['file'])) {
  8.   $blacklist = array(".php", ".phtml", ".php3", ".php4", ".cgi", ".sh", ".shtml", ".asp", ".py", ".jsp", ".pl", ".htm");  
  9.   foreach ($blacklist as $item) {  
  10.   if(preg_match("/$item$/i", $_FILES['userfile']['name'])) {  
  11.   header('HTTP/1.1 500 Internal Server Error');
  12.   include("/var/www/500.html");  
  13.   exit;  
  14.   }
  15. }
  16.   $filename = $upload_dir . basename($_FILES['file']['name']);
  17.   move_uploaded_file($_FILES['file']['tmp_name'], $filename);
  18.   echo "Upload Completed!";
  19.   } else {
  20.    header('HTTP/1.0 500 Internal Server Error');
  21.    include("/var/www/500.html");
  22.   }
  23. } else {
  24.    header('HTTP/1.0 404 Not Found');
  25.    include("/var/www/404.html");
  26. }
  27.  
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement