jperezmedina / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

Cannot modify header information when BLOCK_EXTERNAL_LEECHERS set TRUE #266

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. define ('BLOCK_EXTERNAL_LEECHERS', TRUE);

What version of the product are you using? On what operating system?
VERSION 2.8

Please provide any additional information below.
PHP Warning: Cannot modify header information - headers already sent by (output 
started at /path/here/timthumb.php:206) in /path/here/timthumb.php on line 1165
PHP Warning: Cannot modify header information - headers already sent by (output 
started at /path/here/timthumb.php:206) in /path/here/timthumb.php on line 1166
PHP Warning: Cannot modify header information - headers already sent by (output 
started at /path/here/timthumb.php:206) in /path/here/timthumb.php on line 1167
PHP Warning: Cannot modify header information - headers already sent by (output 
started at /path/here/timthumb.php:206) in /path/here/timthumb.php on line 1168

trying to fix this error in line 1165-1168 by adding some code, here:

if (!(BLOCK_EXTERNAL_LEECHERS && array_key_exists('HTTP_REFERER', $_SERVER) && 
(! preg_match('/^https?:\/\/(?:www\.)?' . $this->myHost . '(?:$|\/)/i', 
$_SERVER['HTTP_REFERER'])))) {
    header ('Content-Type: ' . $s['mime']);
    header ('Content-Length: ' . filesize($file) );
    header ('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
    header ("Pragma: no-cache");
}

I get this work, there is no error for now.

Is there something i missing?

Original issue reported on code.google.com by b420...@klzlk.com on 22 Sep 2011 at 2:25