HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/promic.komma.pro/wwwroot/english/kms/download.php
<?php
session_start();
include("connect.php");
if ($_SESSION['login_oke'] == true){
	if (isset($_GET["hoe"]) && isset($_GET["wat"])){
		$bestandsnaam = $_GET["hoe"];
		$id = $_SESSION['id'];
		$ext = $_GET["wat"];
		$datum = date("d.m.y");
		$tijd = date("H:i:s");  
		$database_bestand = $bestandsnaam . "." . $ext . "";
		$filename = "downloads/". $bestandsnaam . "." . $ext . "";
	    $headers = "From: Promic Website <info@promic.nl>";
	    $emailadres2 = "info@komma-mediadesign.nl";
		$subject = "Error Downloaden Promic";
		if($ext=="zip" || $ext=="pdf"){//alleen extensie zip en pdf toestaan.
			if ( ! file_exists( $filename ) ){
			  print("This file does not exist or you are not logged in.");
		      $message ="
Beste Stef,

Er is een fout opgetreden op promic.nl

De klant met id $id probeert in het Engels het volgdende bestand: $filename
Te downloaden op $datum om $tijd.

Succes ermee!

Met vriendelijke groet,

Uw Komma Management System";
			$email = mail($emailadres2, $subject2, $message, $headers);
            exit;
			};
			if(ini_get('zlib.output_compression')){
			  ini_set('zlib.output_compression', 'Off');
			}
			switch($ext)
				{
				  case "pdf": $ctype="application/pdf"; break;
				  case "zip": $ctype="application/octet-stream"; break;
				  case "exe": $ctype="application/octet-stream"; break;
				  case "doc": $ctype="application/msword"; break;
				  case "xls": $ctype="application/vnd.ms-excel"; break;
				  case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
				  case "gif": $ctype="image/gif"; break;
				  case "png": $ctype="image/png"; break;
				  case "jpeg":
				  case "jpg": $ctype="image/jpg"; break;
				  default: $ctype="application/force-download";
				}
				header("Pragma: public"); // required
				header("Expires: 0");
				header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
				header("Cache-Control: private",false); // required for certain browsers 
				
				if(!ereg("MSIE 7.0",$_SERVER['HTTP_USER_AGENT'])){ 
					//removing the Content Type for IE 7 seems to work
					header('Content-Type: '.$ctype);
				}
				if(!ereg("MSIE 8.0",$_SERVER['HTTP_USER_AGENT'])){ 
					//removing the Content Type for IE 8 seems to work
					header('Content-Type: '.$ctype);
				}
				header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
				header("Content-Transfer-Encoding: binary");
				header("Content-Length: ".filesize($filename));
				readfile("$filename");
				$q = "INSERT INTO downloads(account_id,	bestandsnaam, taal, datum, tijd) VALUES ('$id', '$database_bestand', 'eng', '$datum', '$tijd')";
				$r = mysql_query($q);
				exit();
		}else{
     	  print("This file does not exist!");
		  $message2 ="
Beste Stef,

Er is een fout opgetreden op promic.nl

De klant met id $id probeert in het Nederlands het volgdende bestand: $filename
Te downloaden op $datum om $tijd.

Waarschijnlijk is er sprake van fraude met een verkeerde extensie.

Succes ermee!

Met vriendelijke groet,

Uw Komma Management System";
		  $email = mail($emailadres2, $subject2, $message, $headers);
		  exit;
		}
	}
}else{
	  print("This file does not exist or you are not logged in.");
	  exit;
}
?>