عرض مشاركة واحدة
  #11  
قديم 19-06-2005, 02:03 PM
نيو هنا نيو هنا غير متواجد حالياً
عضو جديد
 
تاريخ التسجيل: Jun 2005
المشاركات: 8
معدل تقييم المستوى: 427
نيو هنا مثابر
افتراضي

أخي الطيب ما وجدت وهذا الذي داخل الملف
وشاهد بنفسك
<?php
error_reporting(7);

$noheader=1;

require("./global.php");

if ($postid) {
$postid=verifyid("post",$postid);
} else {
$attachmentid=verifyid("attachment",$attachmentid) ;
}

$getforuminfo=$DB_site->query_first("SELECT forumid".
iif($postid,',attachmentid ','')."
FROM thread,post
WHERE post.threadid=thread.threadid ".
iif($postid,"AND post.postid='$postid'","AND post.attachmentid='$attachmentid'")."
");

$permissions=getpermissions($getforuminfo[forumid]);
if (!$permissions[canview] or !$permissions[cangetattachment]) {
show_nopermission();
}

if ($postid) {
$attachmentid=$getforuminfo[attachmentid];
}

if (!$attachmentinfo=$DB_site->query_first("SELECT filename,filedata,dateline,visible
FROM attachment
WHERE attachmentid='$attachmentid'")){
$idname='attachment';
eval("standarderror(\"".gettemplate('error_invalid id')."\");");
exit;
}

if ($attachmentinfo['visible'] == 0) {
if (!ismoderator($getforuminfo[forumid],"canmoderateattachments")) {
$idname='attachment';
eval("standarderror(\"".gettemplate('error_invalid id')."\");");
exit;
}
}

updateuserforum($getforuminfo['forumid']);

if ($noshutdownfunc) {
$DB_site->query("UPDATE attachment SET counter=counter+1 WHERE attachmentid='$attachmentid'");
} else {
$shutdownqueries[]="UPDATE LOW_PRIORITY attachment SET counter=counter+1 WHERE attachmentid='$attachmentid'";
}

if (strstr($HTTP_USER_AGENT,"MSIE")) {
$attachment = '';
} else {
$attachment = ' atachment;';
// We could still be MSIE behind a firewall blocking USER_AGENT so use something that will work!!
}

header("Cache-control: max-age=31536000");
header("Expires: " . gmdate("D, d M Y H:i:s",time()+31536000) . "GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s",$attachmentinfo[dateline]) . "GMT");
header("*******-disposition:$attachment filename=$attachmentinfo[filename]");
header("*******-Length: ".strlen($attachmentinfo[filedata]));
$extension=strtolower(substr(strrchr($attachmentin fo[filename],"."),1));

if ($extension=='gif') {
header('*******-type: image/gif');
} elseif ($extension=='jpg' or $extension=='jpeg') {
header('*******-type: image/jpeg');
} elseif ($extension=='png') {
header('*******-type: image/png');
} elseif ($extension=='pdf') {
header('*******-type: application/pdf');
} else {
header('*******-type: unknown/unknown');
}
echo $attachmentinfo[filedata];

?>
رد مع اقتباس