<?
/*** Let's Roll!
*
*
* Sample Usage:
*
* <img src="image.php?myLogo.gif" />
*
*
* You can freely use this script as long as this header remains intact
*
**/
$allowed = array ( '4arrow.com' , 'montros.org' , 'phportal.org' );
$ref = $_SERVER['HTTP_REFERER'];
$imagedir = '/HiddenPathTo/MyImages/';
$image = $argv[0];
if ( $ref != '' && $image != '' ) {
foreach ( $arr as $u ) {
if ( strpos ( $ref , $u ) !== false ) {
$g=1;
break;
}
}
if ( $g != 1 ){
die ( Header( 'HTTP/1.0 403 Forbidden' ) );
} else {
// load image
$imagepath = $imagedir . $image;
$imageinfo = getimagesize ( $imagepath );
$fp = fopen ( $imagepath , 'rb' );
if ( $imageinfo && $fp ) {
header ( 'Content-Type: ' . $imageinfo['mime'] );
die ( fpassthru ( $fp ) );
} else {
die ( Header ( 'HTTP/1.0 404 Not Found' ) );
}
}
} else {
// direct call redirect to root
die ( header ( 'Location: /' ) );
}
?>