ok, heres the part of the code, I think it is..
PHP Code:
// read file
$filenum = fopen($attachment,"rb");
$filestuff = fread($filenum,$filesize);
fclose($filenum);
unlink($attachment);
$visible = iif($moderate,0,1);
// add to db
if (!$allowduplicates) {
if ($result=$DB_site->query_first("SELECT attachmentid
FROM attachment
WHERE userid = '$bbuserinfo[userid]'
AND filedata = '".addslashes($filestuff)."'")) {
$threadresult=$DB_site->query_first("SELECT post.threadid as threadid,thread.title as title FROM post
LEFT JOIN thread ON (thread.threadid = post.threadid)
WHERE post.attachmentid=$result[attachmentid]");
$threadresult['title'] = htmlspecialchars($threadresult['title']);
eval("standarderror(\"".gettemplate("error_attachexists")."\");");
exit;
}
}
$DB_site->query("INSERT INTO attachment (attachmentid,userid,dateline,filename,filedata,visible,private) VALUES (NULL,$bbuserinfo[userid],".time().",'".addslashes($attachment_name)."','".addslashes($filestuff)."','$visible','$private')");
$attachmentid=$DB_site->insert_id();
}
return $attachmentid;
}
So do you know what I can do to modify this code to take out the error, or do you know based upon that code what query to run?
Thanks for the help, very much appreciated.