1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Logout Form with xfConfirm

Discussion in 'XenForo Development Discussions' started by LPH, Mar 16, 2015.

  1. LPH

    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?
     
  2. Jake B.

    Jake B. Well-Known Member

    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; ?>" />
    
     
  3. Mr. Goodie2Shoes

    Mr. Goodie2Shoes Well-Known Member

    This will throw an error... needs to be changed to:
    Code:
    <input type="hidden" name="_xfToken" value="<?php echo $visitor['csrf_token_page']; ?>" />
    
    :p
     
  4. Jake B.

    Jake B. Well-Known Member

    Pf, details. :whistle:
     
  5. LPH

    LPH Well-Known Member

    Thank you everyone.

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

Share This Page