We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

fris on 03/05/08


Tagged

image filename


Versions (?)


simple image display


Published in: PHP 


  1. <?
  2. $fname = $_GET['id'];
  3. if(!isset($fname)) { die("no file specified");}
  4. else if (!file_exists($fname)) { die("file not found");}
  5. else echo "<image src=\"".$fname."\" border=\"0\">";
  6. ?>

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: jimmayes on March 5, 2008

don't forget to filter that $_GET variable before echoing it to the page to prevent XSS hacks

You need to login to post a comment.