MyBB Community Forums

Full Version: ACP > Legalize POST button
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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>", "", "");
$form_container->end();
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.
Add in your form:
<input type=\"hidden\" name=\"my_post_key\" value=\"{\$mybb->post_code}\" />
Thanks, it works.