2009-06-30 08:05:37 +00:00
|
|
|
<?php
|
2009-06-30 08:12:47 +00:00
|
|
|
// $Header: /cvsroot/phpldapadmin/phpldapadmin/view_jpeg_photo.php,v 1.5 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
|
|
|
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 08:07:14 +00:00
|
|
|
require 'common.php';
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
$file = $_GET['file'];
|
|
|
|
|
|
|
|
// Security check (we don't want anyone tryting to get at /etc/passwd or something)
|
2009-06-30 08:10:17 +00:00
|
|
|
preg_match( "/^pla/", $file ) or
|
2009-06-30 08:09:20 +00:00
|
|
|
pla_error( $lang['unsafe_file_name'] . htmlspecialchars( $file ) );
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
$file = $jpeg_temp_dir . '/' . $file;
|
|
|
|
file_exists( $file ) or
|
2009-06-30 08:09:20 +00:00
|
|
|
pla_error( $lang['no_such_file'] . htmlspecialchars( $file ) );
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
// little security measure here (prevents users from accessing
|
|
|
|
// files, like /etc/passwd for example)
|
|
|
|
$file = basename( $file );
|
|
|
|
$file = addcslashes( $file, '/\\' );
|
|
|
|
$f = fopen( "$jpeg_temp_dir/$file", 'r' );
|
|
|
|
$jpeg = fread( $f, filesize( "$jpeg_temp_dir/$file" ) );
|
|
|
|
fclose( $f );
|
|
|
|
|
|
|
|
Header( "Content-type: image/jpeg" );
|
|
|
|
Header( "Content-disposition: inline; filename=jpeg_photo.jpg" );
|
|
|
|
echo $jpeg;
|
|
|
|
|
|
|
|
?>
|