espace-couture-sittler.fr /spip/prive/images/wrapper.php

Language PHP Lines 29
MD5 Hash 5bf48006dafa0ca8a4d1e072d7a8cd78
Repository https://github.com/eyeswebcrea/espace-couture-sittler.fr.git View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

	// wrapper image pour scintillement MSIE, cf.
	// http://www.ultra-fluide.com/ressources/css/css-hacks.htm#scintillement
	if (isset($_GET['file'])){
		$f = $_GET['file']; // pas de urldecode ici car on accepte de toute facon que les caracteres alphanumeriques
		if (preg_match(',^[a-z_0-9\-]+\.(gif|jpg|png)$,i', $f, $r)
				AND @file_exists('./'.$f)){
	
			$mime = array(
				'jpg' => 'image/jpeg',
				'gif' => 'image/gif',
				'png' => 'image/png'
			);
		
			header('Content-Type: '.$mime[strtolower($r[1])]);
			header('Content-Length: '.filesize('./'.$f));
			header('Cache-Control: max-age=36000');
			header('Pragma: public');
			readfile('./'.$f);
			exit;
		}
	}
	
	header("Status : 404 Not Found"); 
	die('404 not found');

?>
Back to Top