ACC SHELL

Path : /srv/www/vhosts/marevva/nadacekrizovatka/parts/
File Upload :
Current File : /srv/www/vhosts/marevva/nadacekrizovatka/parts/article-file-send-mail.php

<?php

	header("Content-type: text/plain; charset=UTF-8");
	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
	header("Cache-Control: no-store, no-cache, must-revalidate");
	header("Cache-Control: post-check=0, pre-check=0", false);
	header("Pragma: no-cache");
	
	include( '../init-db-info.php' );
	include( '../init-db.php' );
	
	if ( isset( $_POST['docFormEmail'] ) && isset( $_POST['fileURL'] ) && isset( $_POST['fileName'] ) && isset( $_POST['articleID'] ) )
	{
		$hash = sha1( time() . $_POST['docFormEmail'] );
		
		$db->insertItem( 'downloadHistory', 
					  array( 
							 'articleID' => $_POST['articleID'], 
					  		 'fileName' => $_POST['fileName'], 
							 'fileURL' => $_POST['fileURL'], 
							 'hash' => $hash,
							 'email' => $_POST['docFormEmail'],
							 'status' => 0
						   ) );
						   
		// mail
		$settings = $db->getItem( 'settings', 1 );
		$emailFromEmail = $settings['contactFormEmail'];
		$emailTo = $emailFromEmail;
		$emailFromName = $settings['contactFormEmailName'];
		$emailSubject = 'Soubor ke stazeni';
	
		$headers  = 'MIME-Version: 1.0' . "\r\n";
		$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
		$headers .= "From: " . $emailFromName . " <" . $emailFromEmail . ">\r\n";
		
		$email = '
			<a href="http://'.$_SERVER['HTTP_HOST'].'/download/'.$hash.'" target="_blank">' . $_POST['fileName'] . '</a>
		';
		mail( $_POST['docFormEmail'], $emailSubject, $email, $headers );
	}

?>

ACC SHELL 2018