PDA

View Full Version : Attachments Not in Database


Scott MacVicar
21 Jan 2002, 22:00
This is a hack which allows you to save the attachments as files and not within the database. The main problem with this was the fact that it posed certain security issues, these have been tackled by doing the following

Placing the folder below document root
Using random hashes to name the file
Changing the file extension to .file
Never divulging the path to the file


This is a beta hack, it has been tested on a development board. I have had insufficent time to fully complete the attachment importer, this removes the files from the database and creates them as physical files in the attachment folder. I will post this as soon as possible.

Looking forward to your feedback.

Scott

To install this hack upload this file to the admin directory and then view it in your browser.

All the changes that Jawelin suggested have been applied, thanks man :)

Dade
21 Jan 2002, 23:27
Man oh man, thanks! :eek: :D

MrLister
22 Jan 2002, 02:11
this is great. Although I can't experiment much with it I hope people that install it say how it goes.

SaintDog
22 Jan 2002, 04:09
I will install it on my test board tonight and let you know how it goes PPN.

SaintDog
22 Jan 2002, 04:31
Well, I have just installed it and was about to test it yet I noticed the below, is there suppsed to be 5 boxes to place the root directory path in?

Scott MacVicar
22 Jan 2002, 07:14
how many times did you run the query to insert into settings???

Martz
22 Jan 2002, 08:17
PPN you ARE the man :)

Not going to install this just yet, but a massive thanks for making it! - it is needed by the masses!

Scott MacVicar
22 Jan 2002, 08:51
i've completed the other bits i forgot about, the edit and delete options that are placed around the vBulletin files.

I'm in school at the moment so i'll load the file when i get home and mention it in the first post, will also work on an installer file.

SaintDog
22 Jan 2002, 09:14
Originally posted by PPN
how many times did you run the query to insert into settings???

Only once for each query - this is being run from my windows server though so there could be some problems.

I will try again though with a clean install.

epic
22 Jan 2002, 09:41
something wrong when use this hack

Warning: Unable to create '/67ed09c75ae139a48b26650ba25e91cb.file': Permission denied in /home/httpd/html/vb/admin/functions.php on line 1742

Warning: Unable to move '/tmp/phpqNA6RJ' to '/67ed09c75ae139a48b26650ba25e91cb.file' in /home/httpd/html/vb/admin/functions.php on line 1742

My 1742 line is
move_uploaded_file($attachment, "$path");

Lesane
22 Jan 2002, 12:36
Great PPN, gonna test this hack later.

Scott MacVicar
22 Jan 2002, 14:50
@SaintDog
I wrote this hack on a windows2000 server and it worked fine on it, also tested it on a linux system and a raq, havent had any problems. Tested them both with and without safe mode enabled in php, again no problems.

@epic
you haven't set the path to move the files to in the options part of the control panel. There is a large paragraph at the bottom of the hack file, read this and do what it says.

Martz
22 Jan 2002, 15:21
Quick question:

Will this maintain the permission for each attachment in a private forum? I.E. if an attachment is posted in the moderators forum - will registered users still be able to see it?

Thanks.

Scott MacVicar
22 Jan 2002, 15:27
yes it will, the only difference between this and normal attachments is where it is stored.

As they are required to download the file via attachment.php the appropriate security checks will still be done before they are given the content.

epic
22 Jan 2002, 16:03
Originally posted by PPN
@SaintDog
I wrote this hack on a windows2000 server and it worked fine on it, also tested it on a linux system and a raq, havent had any problems. Tested them both with and without safe mode enabled in php, again no problems.

@epic
you haven't set the path to move the files to in the options part of the control panel. There is a large paragraph at the bottom of the hack file, read this and do what it says.
I use this hack accord your attachment file.

Scott MacVicar
22 Jan 2002, 16:05
Please download the file and re-apply the hack there was many changes in all of the editing as well as alot of new bits to allow for editing and upload of new attachments.

Scott MacVicar
22 Jan 2002, 22:03
I've created an installer file using the installer by Bane and Tubedogg to allow for easy changes to the sql database and an easier way to view what changes have to be made to the php files.

This is the exact same as the text file that was up earlier just it is in php form.

MarkB
22 Jan 2002, 23:24
When do you think the attachment db > file importer will be ready?:)

epic
23 Jan 2002, 04:09
I solved this problem
1ЁЂchange

INSERT INTO `setting` (`settingid`, `settinggroupid`, `title`, `varname`, `value`, `description`, `optioncode`, `displayorder`) VALUES ('', '27', 'Attachment File Directory', '$attachpath', '/home/username/attachments', 'The directory where attachments will be stored, below the document root is recommended.', '', '1');

to

INSERT INTO `setting` (`settingid`, `settinggroupid`, `title`, `varname`, `value`, `description`, `optioncode`, `displayorder`) VALUES ('', '27', 'Attachment File Directory', 'attachpath', '/home/username/attachments', 'The directory where attachments will be stored, below the document root is recommended.', '', '1');

2ЁЂopen admin/functions.php
change

global $safeupload,$tmppath, $allowduplicates, $allowimgsizefailure;

to

global $safeupload,$attachpath,$tmppath, $allowduplicates, $allowimgsizefailure;

But there something wrong
When i delete the attachment in post,i find the filefolder's file(.file)could not be deleted.how to solve?

Scott MacVicar
23 Jan 2002, 07:05
epic you are using an old version of this hack which had some problems, if you had read the reply to your post it says please download the new file and install the hack again, I'll remind you that this is a beta hack so the format is constantly changing.

Its at a semi stable version just not, when you edit posts you can change attachment and it alters the files as well as the moderation of attachment is allowed.

kermit
23 Jan 2002, 10:47
I get this?..

Warning: Supplied argument is not a valid MySQL result resource in myfullpath/admin/db_mysql.php on line 154

Hmmm

Scott MacVicar
23 Jan 2002, 11:18
is this in the install file or another file?

kermit
23 Jan 2002, 11:22
In the install file..

UserName
24 Jan 2002, 00:54
I'm excited about using this and getting rid of our huge attachments table, which is currently the cause of many slow MySQL queries.

Are there people currently using this hack without problems or are you still in test mode?

epic
24 Jan 2002, 03:44
Originally posted by PPN
epic you are using an old version of this hack which had some problems, if you had read the reply to your post it says please download the new file and install the hack again, I'll remind you that this is a beta hack so the format is constantly changing.

Its at a semi stable version just not, when you edit posts you can change attachment and it alters the files as well as the moderation of attachment is allowed.
Thx.

Scott MacVicar
24 Jan 2002, 07:02
I have an importer but no tests of the import worked on large boards.
I'm gonna test on my own board tonight

jardragon901
26 Jan 2002, 09:55
any news? this sounds like an awesome hack and I would like to install it :) .

Jawelin
26 Jan 2002, 11:27
Originally posted by PPN
[...]
Importer has been added, this hack is now ready fir beta testing

Last edited by PPN on 01-26-02 at 12:18 PM


GREAT!!! ;)
Let's go!!!

Jawelin
26 Jan 2002, 13:31
Great performance, PPN !!!

Just installed and trying it !!!
I plan to use the installer to extract from db about 11 megs of attachments (a hundred files). First of all, of course, backupped the table and the entire database.

Well, now, just before uploading new modified files, my question are:

- attachment.php: there's a file open $fp = fopen($path, "rb");, but no fclose() ... :confused:

- editpost.php: there are two ccurrances of $DB_site->query("DELETE FROM attachment WHERE attachmentid=$postinfo[attachmentid]");What do you refer to ?

- It would be possible to switch on or off the attachment destination with an (im/ex)porter at AdminCP level ? This way an Admin could decide any time to save into db rather than to file, and so on. I mean, a stand-alone db<->file switcher selectable from CP. This reason I renamed the old function acceptupload( into acceptupload2db( instead of overwriting it into functions.php

- My web directories aren't browsable: could I make a slight modification to be able to recognize myself (with ftp) the stored files ? I mean changing the name which still would include the same hash of the table, but also the original filename and extension. As a first saw, I think I should change only the ways filename.ext are builded and retrieved (attachment.php & functions.php), shouldn't I ?

Thanks a lot for your hard work (I know as tried myself...) and for answering me all the time.. ;)


P.S.: just a typo correction to the installer: file name moderate.php should be mod/moderate.php ... ;)

Thanks again.

Scott MacVicar
26 Jan 2002, 15:44
both refrences in editpost.php require to have the function above it

changing between database and flatfile defeats the purpose of why the hack was created, it was to stop the /var folder being filled up as my attachment table is 50mb and it caused problems dumping the table and if the tables crashed it got corrupted among other things.

I think i missed out some files now that i think about it. The moderate feature in the admin panel and the simply /moderator.php file as well as the /mod/moderate.php

I'll look into this now

Jawelin
27 Jan 2002, 09:26
Originally posted by PPN
both refrences in editpost.php require to have the function above it
[...]
I think i missed out some files now that i think about it. The moderate feature in the admin panel and the simply /moderator.php file as well as the /mod/moderate.php

I'll look into this now Thanks. About moderate.php, I was just meaning that file was in the 'mod/' folder, not at the same level of others... And, as you specified the folder for functions.php, it should be cleaner the same notation to that file. Just typo, as said.... :kiss:

The other question ? Well, I hwr think it should be useful; as the "attachment as file" option is in settings and any time could be changed with a radio button, I absolutely think it should be a way (AdminCP menu) to move files out/in from/to DB...
Don't you agree ?

Thanks again.

P.S.: hope my question should be useful and not harmful... :supwink:

Jawelin
27 Jan 2002, 10:42
Just an add:

In admin/functions.php, function deletethread(, there is if ($attachmentids!="") {
$DB_site->query("DELETE FROM attachment WHERE attachmentid IN ($attachmentids"."0) AND NOT attachmentid IN ($omitattachmentids"."0)");
}
I think just before should be a removeattachment(); call even there, should not ?



Besides, I think there's a little bug in building filename:
in the same admin/functions.php, there's
$attachment_hash = md5(uniqid(microtime())).".file";
which builds the hash appending '.file' extension.
Just later the same hash is INSERTed INTO db.

But all the times the same hash is red in other files, it's again appended another '.file' string.
This way I definetively think a file named 'hash.file.file' should be searched, when the file in dir is 'hash.file'...
:confused:

Again, hope this helps.

Thanks again.
Bye

Martz
27 Jan 2002, 14:02
PPN how hard would a hack be which saved attachments into a remote database, specified in the attachment.php or a seperate config file? At the moment I am paying a lot of my main mySQL database which is quite powerfull. However I am filling it with attachments quickly and I have some cheaper, slower mySQL space which I would like to use for attachments. This could then get to be many GB's instead of having to not use them at all.

Any help appreciated, I would even have a go at it myself!

Scott MacVicar
27 Jan 2002, 14:45
Jawelin: I have to work out a simple way to do that as its a list of attachment id's, i'm sure i'd have to explode the variable and then do a foreach loop. Will look into this in a bit and then i'll look into the mistake with the hash

Jawelin
27 Jan 2002, 18:54
Thanks for the answer, even don't understood... :kiss:

Anyway I'll wait for your newer release.
LMK if you'd like to know some other evaluations made by me.
:stupid:
Bye

Scott MacVicar
27 Jan 2002, 19:12
Martz, this would double your bandwidth usage though, from mysql database to server with forums, then from forums to user. So if they download a 5mb file then its really 10 on your bandwidth.

Why not simply make the attachments as files or are you short on space?

Martz
27 Jan 2002, 19:27
Well, im short on disk space as well since I'm on a shared server. 200mb disk space and 300mb mySQL space. Like I said, I'm at about 220mb now, and I've disabled attachments. The remote mySQL space is pretty much unlimited as it will be hosted by orange.net.

I dunno what to do, and I can't move everything to the orange.net mySQL server :(

Scott MacVicar
27 Jan 2002, 22:04
Orange are my cell phone provider :P

how the hell did you get mysql space with that lol

Martz
27 Jan 2002, 23:46
Because the Futures bright ;)

They provide gaming services for UT, like UT servers and some web bits and pieces. They have an IRC server (ripper.unreal.orange.net) linked to a small network of ours.

The mySQL space is arranged, however I need to be able to hack it to work. :)

I said I would modify the attachment to advertise the site http://unreal.orange.net for each attached file after "Nickname has attached this file" in posts.

Martz
30 Jan 2002, 11:41
I now have my mySQL space with orange, the table setup, phpmyaddmin working etc etc.

Any suggestions for making the hack above?

Jawelin
30 Jan 2002, 16:48
Originally posted by PPN
Jawelin: I have to work out a simple way to do that as its a list of attachment id's, i'm sure i'd have to explode the variable and then do a foreach loop. Will look into this in a bit and then i'll look into the mistake with the hash PPN, sorry for this reminder, but I'm in trouble with half this hack installed (just the modifications to the DB) and absolutely need to make the tabledump lighter before upgrading to v2.2.2 ...
So, I'm here again to ask to discuss about the unsolved problems.

Sorry again. Hope you could understand.
Thanks.

Scott MacVicar
30 Jan 2002, 17:22
I've been busy with school work and i'll look into it in about 2 hours I have some stuff I need to finish before I can check it over. I've also just changed to a new system so moving the files has taken a while too.

Will post a finish to this hack tonight and then get it moved into the full releases section.

Scott MacVicar
30 Jan 2002, 22:25
sorted the problem with an extra .file being appended, this was caused by a problem when the file was created, I recommend apply the getupload function again and the other modification to functions.php which was added to remove the attachments when a thread was deleted.

Jawelin
31 Jan 2002, 13:57
Thanks a lot.
Such a fast and positive ack should make me mind my advice wasn't boring. ;)
I'll full reapply the entire hack and still minded trying to create an offline importer/exporter to follow the VB settings.
If pleased, will let you know.

Hope see u soon in FullReleases Area.
Thanks.

Jawelin
31 Jan 2002, 15:12
First question: you suggest an attachment directory below the document root, like '/home/username/attachments'.
This way, it's outside of the public_html folder, so files can't be accessed and executed via web.
- Does the attachment.php access them without problem ?
- This way isn't necessary yet to change the extension and the nature of the file, is it ?

Thanks again
Bye

Scott MacVicar
31 Jan 2002, 15:20
attachment.php is modified to open the file then read the contents so it doesn't have a problem with files below or above document root you could even place it in a directory in the root of the drive as long as php have permission to read and write to that direcotry.

Why would you want to change the extension of the file? If you do then it could become executable, its simplier to name it .file as then it wouldn't be executed

Jawelin
31 Jan 2002, 21:21
No problem about appending one (or two?) '.file' as extension, even to a random hash to make the filename unpredictable.
I would prefer - and think to modify the hack this way - append all these diversions to the true filename; this way, browsing the dir via ftp or telnet or whatever, I'll suddendly recognize the file and have the perception of what it is...
That's all ....
My need, of course. It shouldn't be too difficult to add the truename to the hash in 3-4 points, I think.
I would it become something like : "filename.ext.hash.file"
Almost unpredictable, bust still recognizable... ;)

Thanks
Bye

Scott MacVicar
31 Jan 2002, 21:47
oh by ftp / telnet i have my own attachment browser in the admin panel :)

you can get all attachments by users or forums and it lists the attachments and then you can view or download or edit etc, its a tool i found that i use alot.

Jawelin
31 Jan 2002, 22:06
Is the browseatt.php hack ? :supwink:
Otherwise, name and location, please!!!
:p
Thnx

Scott MacVicar
31 Jan 2002, 23:23
no its something that i wrote it my extensive spare time for someone who paid me for it :D and i simply use a copy modified slightly for my site.

Jawelin
01 Feb 2002, 12:06
I have a LOT of problems with the importer. :cry: :cry:
First of all, in attachment_install.php there's the line:$DB_site->query("UPDATE attachment SET hash='$hash'"); which updates at once ALL THE table, not only the fetched row.
I think that query should be added of WHERE attachmentid='$files[attachmentid]' ...
Do you agree ?

Second, each file I get the error Warning: Supplied argument is not a valid File-Handle resource in /home/...... /admin/attachment_install.php on line 330

I have about 70 files. What should be the right per-number to insert ?

Last, I saw fortunately the importer doesn't delete the filedata from the table. Should I do manually after a successful export ?

Thanks a lot.
Hope in your quick answer.
Bye

Jawelin
01 Feb 2002, 13:42
Besides, the directory couldn't be chmoded to 0666 as no file could be red or written.
I think should be better CHMOD 0777 attachments directory and replace in admin/functions.php:
move_uploaded_file($attachment, "$path");with: move_uploaded_file($attachment, "$path");
chmod ("$path", 0666);Infact, otherwise any uploaded file should have 0755, i.e. executabe but not deletable.

What do you think ?
Thanks

Jawelin
01 Feb 2002, 14:44
Another slight question.
editpost.php?action=deletepost :
if the post contains an attachment, the row into db is deleted, not the file as itsn't explicitly called your removeattachment() function.

Solution:
In admin/functions.php add : removeattachment($postinfo[attachmentid]);just before the line:$DB_site->query("DELETE FROM attachment WHERE attachmentid=$postinfo[attachmentid]");

Thanks.
Bye

Scott MacVicar
01 Feb 2002, 16:32
i'll look into this tonight and go over the importer again.

Scott MacVicar
01 Feb 2002, 19:07
At most the files should be 0666 never chmod a file to 777 or 755. As they should never require to be executed.

I've installed this on my boards without any problems with attachments. The importer has been updated to correct the has problem. Regarding your file problem I would try to ensure that your directory is chmod'd to 666 and that is set correctly within the admin panel.

Thanks for pointing out the missing delete from attachment part with the deletepost, I have updated the installer.

If I remember correctly though the file will automatically have permissions to read and thats all you need as it only reads the files and it deletes it using the unlink function.

Jawelin
01 Feb 2002, 21:49
:( I tried many and many times (Linux shared server....)

both /home/user/public_html/attachment & /home/user/attachment ...
The only way I don't get an error downloading or uploading attachment is that dir chmoded to 0777.
Because the user owns the files is 'nobody', who otherwise couldn't access the directory itself, if not executable.
This way, the uploaded file moved from /tmp to here is moded to 0755. So to make it not executable, i changed permissions within php code, right after the move_uploaded...., to 0666 (tried 0644 but the file couldn't deletable, as not writable...)

Now it works to me, only this way, on that linux server ... :eek:
Thnx

Scott MacVicar
02 Feb 2002, 00:40
i suppose i can make those modifications to the files.

I tested the script without the permission modifications on a Win2k and a linux server though i was running it under root.

Will do the final modifications you suggested then ponder moving it into the full releases.

Ninth Dimension
02 Feb 2002, 15:41
Hi, I just wanted to check the latest on this hack, is the file on the front page of this thread the latest verson, and if not, would you be able to upload a more up to date verson please?

I'm desprate to use this hack because although i've got lots of HHD memory available, i've only got 20MB is MySQL space (and the forum is already taking up 10MB's of that space.

Please let me know, thank you :)

Ninth Dimension
02 Feb 2002, 17:06
I have just installed this hack, however i'm getting some errors, first off I tried the importer and got a page full of errors, like this:
Warning: Supplied argument is not a valid File-Handle resource in /hsphere/local/home/ofdan/bbs.ofdan.net/admin/attachment_install.php on line 332

Imported pool1.jpg


Warning: Supplied argument is not a valid File-Handle resource in /hsphere/local/home/ofdan/bbs.ofdan.net/admin/attachment_install.php on line 332

Imported diablo.gif


Warning: Supplied argument is not a valid File-Handle resource in /hsphere/local/home/ofdan/bbs.ofdan.net/admin/attachment_install.php on line 332

Imported cap_026.jpgIgnoring this for a moment I then tested uploading a file, and got this errorWarning: Unable to create '/hsphere/local/home/ofdan/bbs.ofdan.net.attachments/4b7be3dffed063f1b35f072d3f5dfecf.file': Permission denied in /hsphere/local/home/ofdan/bbs.ofdan.net/admin/functions.php on line 1681

Warning: Unable to move '/tmp/phpKqRzkG' to '/hsphere/local/home/ofdan/bbs.ofdan.net.attachments/4b7be3dffed063f1b35f072d3f5dfecf.file' in /hsphere/local/home/ofdan/bbs.ofdan.net/admin/functions.php on line 1681

Warning: stat failed for /hsphere/local/home/ofdan/bbs.ofdan.net.attachments/4b7be3dffed063f1b35f072d3f5dfecf.file (errno=13 - Permission denied) in /hsphere/local/home/ofdan/bbs.ofdan.net/admin/functions.php on line 1684

Ninth Dimension
02 Feb 2002, 18:32
Problem number 2, I think i've solved my first problem, i've chmod'd my attachments dir to 777 (when i done it to 666, it prevented me form accessing it), and this allowed me to upload the attachments without a problem.

Now i can't download them again, I get the following error:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php on line 30

Warning: Cannot add header information - headers already sent by (output started at /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php:30) in /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php on line 58

Warning: Cannot add header information - headers already sent by (output started at /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php:30) in /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php on line 59

Warning: Cannot add header information - headers already sent by (output started at /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php:30) in /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php on line 60

Warning: Cannot add header information - headers already sent by (output started at /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php:30) in /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php on line 61

Warning: Cannot add header information - headers already sent by (output started at /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php:30) in /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php on line 62

Warning: Cannot add header information - headers already sent by (output started at /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php:30) in /hsphere/local/home/ofdan/bbs.ofdan.net/attachment.php on line 66
GIF89aїJJcJJkRRkZZscc{kk„kkŒkk”ss”{{”{{œ„„Ѕ””+œœЕœœЦЅЅНЅЅЮ++Ц++Ю++жЕЕЕЕЕжЕЕоНН жННоЦЦчџїœџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ,+HА A‚4dа сТ†fШ` Zмˆ‘‚РŽ&XЁ$€ JЊ4‰rЅH"œмP0цЬ‚&x0sУ† @№Ќрѓgаœ є,њS QІM%T е'JU›BX€VЈ(НVEЙ ОDЋ– Ш= @ЎнЙ(я68A‚њ=№ї/С…їђ 0`уЧŽ#CfЌє хЫ;

Jawelin
02 Feb 2002, 22:06
Probably new bug found... :(
I can't understand exactly where, but ....
I had some problem about deleting thread (from Admin combo or editing the first post within with delete flag) when it doesn't contain attachments.
--> see here (http://www.vbulletin.com/forum/showthread.php?s=&threadid=38822)

I think there's some problem in function deletethread() [admin/functions.php file...], because removing the code $attachid = $DB_site->query("SELECT attachmentid FROM attachment WHERE attachmentid IN ($attachmentids"."0) AND NOT attachmentid IN ($omitattachmentids"."0)");
while($attachids = $DB_site->query_first($attachid)) {
removeattachment($attachids['attachmentid']);
}
everything works fine.
Have you ever tried to delete a thread without attachments ?

Thanks.
Bye

Scott MacVicar
03 Feb 2002, 00:09
your right
while($attachids = $DB_site->query_first($attachid)) {
should be
while($attachids = $DB_site->fetch_array($attachid)) {

Scott MacVicar
03 Feb 2002, 00:14
daniel we're currently finishing the testing of this hack i've still to do some updates on it though, will do them soon.

Ninth Dimension
03 Feb 2002, 00:32
OK, I tried to install it and got the errors that I listed above. I've now reverted back to a back up copy of the site, but as soon as this hack is up and running correctly then i'll totally be installing it :)

Jawelin
03 Feb 2002, 09:45
Originally posted by PPN
your right
[...]!!!
Great! Less than 2 hrs to findout and fix ! ;)
Elsewhere ?
Thnx

Jawelin
03 Feb 2002, 11:29
Great! Checked and applied all your updates (w/ Araxis Merge... ;) )

Just a curiosity (didn't found on php.net): what's the meaning of the '@' symbol in front of @chmod ("$path", 0666); ?
Thanks

Scott MacVicar
03 Feb 2002, 14:42
it supresses errors, as chmod doesn't exist on NT systems and can sometimes produce an error, You can do this with all php functions to supress errors.

Jawelin
03 Feb 2002, 15:17
Ah, of course...
The same as in NT batch files, to suppress output... (@echo off... etc.)
Php any day more seems an O.S. itself... :p
Thanks

Destee
07 Feb 2002, 18:47
Looking forward to the release of this.

Jawelin
07 Feb 2002, 21:12
Originally posted by Destee
Looking forward to the release of this.
Uh ?!? Lose something ?
---> Post #1 (http://www.vbulletin.org/forum/showthread.php?postid=214860#post214860)

Destee
07 Feb 2002, 21:20
Ohhh I guess I meant the full release ... like not still beta. :)

Jawelin
07 Feb 2002, 21:30
Originally posted by Destee
Ohhh I guess I meant the full release ... like not still beta. :) Oh, sorry!
Actually I think the moving is only a forum-related problem, not the hack's state-of-the-art... :up:
Again...

Destee
07 Feb 2002, 21:33
Well Thank You!! :)

I really need this one. I'll go ahead and test it out for myself. I usually like to wait until things are "final" as my skill set can't handle much! :D

Thanks Again.

waddy
07 Feb 2002, 22:15
An excellent idea and an excellent hack..... will save many database strains

I tried this on a win2K server ... the install went perfectly but when i try to test :

I also get this error

Warning: Unable to create 'wwwroot uke\attach/994be6417c0dcfc35596e16e4e26af13.file': Invalid argument in C:\Inetpub\wwwroot\nuke\forum\admin\functions.php on line 1601

Warning: Unable to move 'C:\PHP\uploadtemp\php54.tmp' to 'wwwroot uke\attach/994be6417c0dcfc35596e16e4e26af13.file' in C:\Inetpub\wwwroot\nuke\forum\admin\functions.php on line 1601

Warning: stat failed for wwwroot uke\attach/994be6417c0dcfc35596e16e4e26af13.file (errno=2 - No such file or directory) in C:\Inetpub\wwwroot\nuke\forum\admin\functions.php on line 1605



I have set the permissions on the directory to allow everything ... and suggestions please

UserName
07 Feb 2002, 22:56
Thanks for all the hard work on this hack.

We have a big vB with a lot attachments. I'd like to know if there are people who have installed this hack without any problems?

We are usually the last to switch or add something new, because we want to learn from other people's mistakes! :)

Thanks again!

Scott MacVicar
07 Feb 2002, 23:33
your path to move it to is set wrong within the admin panel, as i wrote this on a Win 2k server :)

auto
10 Feb 2002, 22:03
Scott, you may remember how I tried the script and it totally filled /var to the top. If I try the script now, will this still happen?

Thanks for your help.

Sean
17 Feb 2002, 01:41
I installed it, and it works great... One problem though, if you try to download WITH the session hash..(attachment.php?s=881293bn832048324n42304&postid=400) then you get an "invalid attachment id error." When you delete the hash...(attachment.php?s=&postid=400)...It works fine and dandy..Should I just get rid of the hash for all the links, or something? Or did I forget to modify something?

Thanks,
Sean

Scott MacVicar
17 Feb 2002, 11:40
ok thats an odd one, there was no changes made to attachment.php which would affect the line which checks the attachmentid verification, especially nothing which involves the session hash.

I'll go test it now on my dev board.

Sean
17 Feb 2002, 14:04
Alright, thanks.

One other thing I did notice, was that mods could download it.. But maybe that's because they don't have a session hash? I will have to find out.

Thanks.

KISS
18 Feb 2002, 07:32
Installed with no problems at all. Is working great!!!!

Very Nice hack and much needed here. Thanks