1<?php 2 if (empty($_GET['recipe_id'])) exit; 3 elseif ($_GET['recipe_id'] < 1) exit; 4 elseif (phpversion() >= '5.2.0' && !filter_var($_GET['recipe_id'], FILTER_VALIDATE_INT)) exit; 5 elseif (!is_numeric($_GET['recipe_id'])) exit; 6 else $recipe_id = $_GET['recipe_id']; 7 8 require_once("../../includes/config_inc.php"); 9 require_once("../../custom_inc.php"); 10 include_once('../../libs/adodb5/adodb.inc.php'); 11 12 $DB_LINK = ADONewConnection($g_rb_database_type); 13 $DB_LINK->debug = FALSE; //debugging will ruin the headers for the image 14 $DB_LINK->Connect($g_rb_database_host, $g_rb_database_user, $g_rb_database_password, $g_rb_database_name); 15 16 $sql = "SELECT recipe_picture,recipe_picture_type FROM $db_table_recipes WHERE recipe_id=" . $DB_LINK->addq($recipe_id, get_magic_quotes_gpc()); 17 $rc = $DB_LINK->Execute($sql); 18 Header("Content-type: " . $rc->fields['recipe_picture_type']); 19 if ($g_rb_database_type=="postgres") { 20 echo $DB_LINK->BlobDecode($rc->fields['recipe_picture']); 21 } else { 22 echo $rc->fields['recipe_picture']; 23 } 24?> 25