MyBB Community Forums
ACP > Legalize POST button - Printable Version

+- MyBB Community Forums (
+-- Forum: Extensions (
+--- Forum: Plugins (
+---- Forum: Plugin Support (
+---- Thread: ACP > Legalize POST button (/thread-230097.html)

ACP > Legalize POST button - Fontane - 2020-11-08

I'm a beginner and need some help for a problem which seems to be a small one for you and which seems to be an unsolvable task for me.

I have defined a button in a PlugIn with which I delete a file. The button is displayed correctly.

This is how the code in the PlugIn looks like:

$form_container = new FormContainer();
 $form_container->output_row("<form action=\"\" method=\"post\">
<input type=\"submit\" name=\"delete_file\" value=\"$lang->_delete_1\"/> $lang->delete_2
</form>", "", "");
if(isset($_POST["delete_file"])) {
unlink(MYBB_ROOT . "/"filename);
If I click on the button, the desired function is executed correctly!

However, the message appears:
Quote:The authorization code could not be confirmed. Please confirm that you want to perform this action.
Currently I hide the error message after the "unlink" with a META Refresh, but this should certainly not be the wisdom last resort.

How to legalize the operation ($_POST) in the PlugIn so that the error message does not appear?

Thank you for any help in advance.

RE: ACP > Legalize POST button - Crazycat - 2020-11-08

Add in your form:
<input type=\"hidden\" name=\"my_post_key\" value=\"{\$mybb->post_code}\" />

RE: ACP > Legalize POST button - Fontane - 2020-11-08

Thanks, it works.