Logout Form with xfConfirm

LPH

Well-known member
I'm trying to build a logout form on an external page.

PHP:
            <form action="<?php echo XenForo_Application::get('options')->boardUrl; ?>/logout" method="post" id="pageLogout">

                <div class="ctrlWrapper">
                    <dl class="ctrlUnit">
                        <dt></dt>
                        <dd>
                            <input type="submit" class="xenword_logout logout" value="log out" />
                        </dd>
                    </dl>
                </div>

                <input type="hidden" name="cookie_check" value="1" />
                <input type="hidden" name="redirect" value="<?php $post = ''; get_permalink( $post->ID ); ?>" />
                <input type="hidden" name="_xfToken" value="$visitor.csrf_token_page " />
                <input type="hidden" name="_xfConfirm" value="1" />

            </form>

This returns a security error even if I remove the xfConfirm. I used to have a direct link to the XenForo logout page but had to always click on confirm so I'm trying to work around it.

Do you have any suggestions on a logout form so that there is no security error and there is no need to confirm?
 
Code:
<input type="hidden" name="_xfToken" value="$visitor.csrf_token_page " />

should be
Code:
<input type="hidden" name="_xfToken" value="<?php echo $visitor.csrf_token_page; ?>" />
 
should be
Code:
<input type="hidden" name="_xfToken" value="<?php echo $visitor.csrf_token_page; ?>" />
This will throw an error... needs to be changed to:
Code:
<input type="hidden" name="_xfToken" value="<?php echo $visitor['csrf_token_page']; ?>" />
:P
 
Thank you everyone.

This almost works but the redirect fails. This is almost what I use to login and the redirect works.
 
Top Bottom