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