Solved: 2 Years, 2 Weeks ago ACP > Legalize POST button
Solved: 2 Years, 2 Weeks ago
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.
Solved: 2 Years, 2 Weeks ago
Add in your form:
<input type=\"hidden\" name=\"my_post_key\" value=\"{\$mybb->post_code}\" />
Do not ask me help through PM or Discord
Solved: 2 Years, 2 Weeks ago
Thanks, it works.

Forum Jump:

Users browsing this thread: 1 Guest(s)