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