Location: PHPKode > projects > VSecure > copy/get_image.php
<?php
/*******************************************************************/
/*                         VSECURITY                               */
/*        COPYRIGHTS(C)2001 JAN VILIMEK(hide@address.com)         */
/*               SEE GPL LICENSE IN FILE LICENSE.TXT               */
/*           AND HTTP://WWW.GUANOWEB.CZ FOR MORE DETAILS           */
/*                                                                 */
/* FUNCTION: SECURE YOUR PAGES  (get_image)                        */
/* FOR INSTALATION SEE README.TXT                                  */
/*******************************************************************/
/*returns image from VSecure Image path - its more safer...*/

$header= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n<head>\n<title>Could not recognize</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#000000\">\n\n<div align=\"center\"><font size=\"+1\"><strong>\n";
$footer="\n</strong></font></div>\n\n</body>\n</html>\n";

define("LOADED_PROPERLY", true);

die ("PATH NOT CHANGED IN ".__FILE__." on line " . __LINE__ .". please specify path to VSecure directory");
$VSecure_absolute_path=dirname(__FILE__)."/VSecure107/"; /*change this path please*/

###################################
# if reading file fails...        #
###################################
function image_fail()
  {
  global $filename,$VSecure_conf;
  Header("Content-type: image/gif");
  if (!@readfile($VSecure_absolute_path."img/Inofound.gif")){Header("text/html");die($header."By reading $filename uknown error occured".$footer);}
  die();
  }

###################################
# reads specific image...         #
###################################
function read_img($name,$path)
  {
   $filename=$path ."img/". $name;
   if (ereg(".png$", $name)) { Header("Content-type: image/png"); }else
                             { Header("Content-type: image/gif"); }
   if (!@readfile($filename))image_fail();
  }

if (isset($id)&&($id!=""))
 {
 #############################################
 # Free ID from path if any                  #
 #############################################
 $id=basename($id);

 } else die($header."Specify ID please: call view.php?id=XXX where XXX is the name of file".$footer);

 read_img($id,$VSecure_absolute_path);

 exit();

?>
Return current item: VSecure