<?php
define ('IN_FSERVE', true);
$root_path = "./";
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($root_path . 'include_all.'.$phpEx);
if ( !$HTTP_USER_DATA['logged'] )
$granted = 0;
$sql = "SELECT * FROM `" . $prefix . "binary` WHERE `id`='" . $id . "'";
$row_file = $db->buffered_db_query($sql);
if ( $row_file[owner] == $HTTP_USER_DATA[userid] )
$granted = 1;
if (!$granted)
deny();
$new_count = $row_file[downloaded] + 1;
$sql = "UPDATE `" . $prefix . "binary` SET `downloaded`='" . $new_count . "' WHERE `id`='" . $id . "'";
$retid = $db->db_query($sql);
header ("Content-type: " . $row_file[content-type]);
header("Content-disposition: filename=" . $row_file[filename]);
header('Pragma: public');
printf ("%s", $row_file[binary] );
?>
kinda hard to explain...
this script is working but what i want is if the content-type of file is an image or a text file then, it should be automatically visible on the browser without prompting the visitor to download the file.
please help... thanks in advance