SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: Photopost Feature on vB
-
Dec 12, 2007, 15:37 #1
- Join Date
- Sep 2001
- Location
- USA
- Posts
- 244
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Photopost Feature on vB
First of all I am not a programmer, just a technical professional, i.e. network admin. I run a large vBuletin board on a dedicated Linux server (7 years old) and I am capable of editing PHP code, but not writing anything from scratch...here is my issue:
I have a problem with some missing attachments...Is there a way to put a if/then or else in the PHP code so that when the attachment is missing I can return something other than this error:
Warning: fopen(/home/admin/attachments/2/5283.attach) [function.fopen]: failed to open stream: No such file or directory in /attachment.php on line 203
That is what you get when you click the attachment link in a post where the actual file is missing. I would just like to have it give a message like: this attachment is no long available, or something like that on a standard vB page so it does not look like the board is messed up.
Thank for anyone that can/will help me!
-
Dec 12, 2007, 16:59 #2
-
Dec 12, 2007, 17:16 #3
- Join Date
- Sep 2001
- Location
- USA
- Posts
- 244
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thanks for the reply, here is the code starting on line 203 in attachment.php where that error starts:
HTML Code:if (!($fp = fopen($attachpath, 'rb'))) { exit; } } else if (!($fp = @fopen($attachpath, 'rb'))) { $filedata = base64_decode('R0lGODlhAQABAIAAAMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='); $filesize = strlen($filedata); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Pragma: no-cache'); // HTTP/1.0 header("Content-disposition: inline; filename=clear.gif"); header('Content-transfer-encoding: binary'); header("Content-Length: $filesize"); header('Content-type: image/gif'); echo $filedata; exit; } }
-
Dec 12, 2007, 17:55 #4
maybe something like this...
Code PHP:if (!($fp = @fopen($attachpath, 'rb'))) { exit; } } else if (!($fp = @fopen($attachpath, 'rb'))) { $filedata = base64_decode('R0lGODlhAQABAIAAAMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='); $filesize = strlen($filedata); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Pragma: no-cache'); // HTTP/1.0 header("Content-disposition: inline; filename=clear.gif"); header('Content-transfer-encoding: binary'); header("Content-Length: $filesize"); header('Content-type: image/gif'); echo $filedata; exit; } } else { echo 'invalid attachment'; }
-
Dec 12, 2007, 18:02 #5
- Join Date
- Sep 2001
- Location
- USA
- Posts
- 244
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
no, that did not work, plus it would need to call up a vB error page.
Bookmarks