PDA

View Full Version : Delete attachment one command


XAM
06-28-2002, 05:43 AM
What variables need to be substituted in string, what to delete the attachment one command?
http://fool.capellan.ru/sm/umn.gif
/editpost.php?s=&action=updatepost&attachmentaction=delete&postid=175707&postinfo[attachmentid]=105
Such command throws out in the empty screen, without error messages, but also does not delete.

http://fool.capellan.ru/sm/val.gif

https://vborg.vbsupport.ru/external/2002/06/1.gif

Admin
06-28-2002, 08:52 AM
You can't do that, but you can delete the attachment with an SQL query:
DELETE FROM attachment WHERE attachmentid = XXX;

XAM
06-28-2002, 09:14 AM
It would be desirable to use possibilities of moduls of a forum. If to use SQL - there is a necessity of creation of all authentications...
in editpost.php unit there is a section

if ($HTTP_POST_VARS['action']=="updatepost") {
....

if (trim($attachmentaction)=="delete") {
$attachmentsql=",attachmentid=0";
$DB_site->query("DELETE FROM attachment WHERE attachmentid=$postinfo[attachmentid]");
updatethreadcount($threadinfo[threadid]);
}
...

How to use the given possibility?

Admin
06-28-2002, 10:56 AM
That section includes many other functions, and to use it as-is you will need to POST data to that page, and that data will need to include the post's message, title, icon, and everything else that the code updates.

You must rewrite it.

XAM
06-28-2002, 11:09 AM
you will need to POST data to that page, and that data will need to include the post's message, title, icon, and everything else that the code updates.


There are no problems!
I have all attributes of the message, and also a thread and forum. Prompt as to generate string(command) - that not calling the web-form "editing post" to delete attachmen... Not forcing the user to press "Save Changes" button.