![]() |
|||
PHP
IT Tags
local server PHP and FLash multiple file uplo magento ecommerce objects Overlapping Layers ajax indexing solr Solr XML SimpleXML XHTML Simplexml Parser my_thread_global_end php mail Remove Duplicate local server Mobile site associative arrays control panel check domain Stop Script mysql server connection to MYSQL Combo box include photo gallery server shutdown Xampp sdf UPDATE |
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> |
