![]() |
|||
PHP
IT Tags
Xampp control panel php mail Combo box include SimpleXML UPDATE indexing solr mysql server local server PHP and FLash multiple file uplo Simplexml Parser magento ecommerce Mobile site check domain sdf Stop Script Remove Duplicate objects ajax XHTML Overlapping Layers associative arrays Solr XML connection to MYSQL server shutdown my_thread_global_end photo gallery local server |
Comments
Dear sir.. Hello, We type below previous posts in this group. Hello, We type below previous posts in this group. --------------------------------------- <td width="41%"> <a href="download.php?img=<?php echo($r[`image_path`]); ?>"> <img src="images/<? echo $r["image_path"]?>" /> </a> </td> download.php ... <?php if(isset($_GET[`img`])) { if(download_img($_GET[`img`])) { die(); } } function download_img($image_filename) { $path_parts = pathinfo($image_filename); $dirname = $path_parts[`dirname`]; if(($dirname != "") && ($dirname != ".")) return FALSE; // the image must have no path info aprt from above $ext = $path_parts[`extension`]; $permitted = "jpg jpeg png gif bmp"; $permitted = explode(" ", $permitted); foreach($permitted as $this_ext) { if($ext = $this_ext) { return output_img($path_parts[`basename`]); } } return FALSE; } function output_img($filename) { if(!file_exists("images/" . $filename)) // hard code the path information so that this // script can`t be used to access other folders { //echo("[" . $filename . "] Does not exist<br>n"); return FALSE; } if(!is_readable("images/" . $filename)) { //echo("[" . $filename . "] Is not readable<br>n"); return FALSE; } header("Cache-Control: public, must-revalidate"); header("Pragma: hack"); header("Content-Type: application/octet-stream"); header("Content-Length: " . filesize($filename)); header(`Content-Disposition: attachment; filename="` . $filename . `"`); header("Content-Transfer-Encoding: binaryn"); readfile("images/" . $filename); return TRUE; } ?> <b>Hacking not permitted</b> etc.... Also note that this script can be placed ate the beging if the script that generated the image selection page so that the pinter can be ... <td width="41%"> <a href="<?php echo($_SERVER[`PHP_SELF`]); ?>?img=<?php echo($r[`image_path`]); ?>"> <img src="images/<? echo $r["image_path"]?>" /> </a> </td> |
