• use protect download from hotlinking

    1 button

    
    <a onclick="location.href='https://site.com/download-file/?id=5672'">Download</a>
    

    2 download-file.php (short php with the full URL)

    
    	$image_url =  'https://site.com/image.png'. '?key_e=93585676651'; 
    	ob_clean(); 
    	header('Content-type: png');		
    	header("Content-Disposition: attachment; filename=\"image.png\""); 
    	header('Content-Transfer-Encoding: binary');
    	echo file_get_contents($image_url);	
    

    images and files are returned damaged
    3 loading pages added to exceptions (checked page code)

    "(*.)download-file(*.)"
    "*download-file*" 
    "{any}download-file{any}"  

    Download starts working fine if you turn off the plugin

    • This topic was modified 4 years, 7 months ago by kolshix.
    • This topic was modified 4 years, 7 months ago by kolshix.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ante Laca

    (@alaca)

    Hi @kolshix

    Try this:
    https://site.com/download-file/?id={numbers}

    • This reply was modified 4 years, 7 months ago by Ante Laca.
    • This reply was modified 4 years, 7 months ago by Ante Laca.
    Thread Starter kolshix

    (@kolshix)

    I tried any options – the files are destroyed when the plugin is turned on
    try on the forehead test site

    
    $image_url =  'https://site.com/image.png'. '?key_e=93585676651'; 
    	ob_clean(); 
    	header('Content-type: png');		
    	header("Content-Disposition: attachment; filename=\"image.png\""); 
    	header('Content-Transfer-Encoding: binary');
    	echo file_get_contents($image_url);	
    
    • This reply was modified 4 years, 7 months ago by kolshix.
    • This reply was modified 4 years, 7 months ago by kolshix.
    Thread Starter kolshix

    (@kolshix)

    as always I had to solve the problem through code

    open “WP-Performance.php”

    
    ...
    defined( 'ABSPATH' ) or exit;
    
    # (after) here my code 
    $string = $_SERVER['REQUEST_URI'];
    if(stristr($string, 'download-file') === FALSE) {
    ...
    # ORIGINAL CODE 
    ...
    } 
    
    • This reply was modified 4 years, 7 months ago by kolshix.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘conflict with file_get_contents();’ is closed to new replies.