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

Security error occurred. Please press back, refresh the page, and try again.

Discussion in 'XenForo Development Discussions' started by Wuebit, Jul 21, 2011.

  1. Wuebit

    Wuebit Well-Known Member

    Am trying to get the search to work on a custom page but everytime I get the error which ive use at this threads title

    I tryed an hacky way of just copying the html output

    HTML:
        <fieldset id="QuickSearch">
            <form action="http://animelon.com/search/search" method="post" class="formPopup">
    
                <div class="primaryControls">
                    <!-- block: primaryControls -->
                    <input type="search" name="keywords" value="" class="textCtrl" placeholder="Forum Search..." results="0" title="Enter your search and hit enter" id="QuickSearchQuery" />
                    <!-- end block: primaryControls -->
                </div>
    
                <div class="secondaryControls">
                    <div class="controlsWrapper">
    
                        <!-- block: secondaryControls -->
                        <dl class="ctrlUnit">
                            <dt></dt>
                            <dd><label for="searchBar_title_only"><input type="checkbox" name="title_only" id="searchBar_title_only" value="1" /> Search titles only</label></dd>
                        </dl>
    
                        <dl class="ctrlUnit">
                            <dt><label for="searchBar_users">Posted by Member:</label></dt>
                            <dd>
                                <input type="text" name="users" value="" class="textCtrl AutoComplete" id="searchBar_users" />
                                <p class="explain">Separate names with a comma.</p>
                            </dd>
                        </dl>
    
                        <dl class="ctrlUnit">
                            <dt><label for="searchBar_date">Newer Than:</label></dt>
                            <dd><input type="date" name="date" value="" class="textCtrl" id="searchBar_date" /></dd>
                        </dl>
                    </div>
                    <!-- end block: secondaryControls -->
    
                    <dl class="ctrlUnit submitUnit">
                        <dt></dt>
                        <dd><input type="submit" value="Find Now" class="button primary"></dd>
                    </dl>
    
                    <a href="http://animelon.com/search/" class="advSearchLink">Advanced search...</a>
                </div>
    
                <input type="hidden" name="_xfToken" value="1,1305569195,61fa6b8df32e2e9d32e3ee9aefd9563934c152c6" />
            </form>
        </fieldset>
    Am guessing its something to do with this Token part.
    Anyone know how I can get this to work?

    Cheers
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    The security error is due to a stale token.

    Are you hard-coding the token value in the template?
     
  3. Wuebit

    Wuebit Well-Known Member

    Indeed.. as am unsure at this time what to replace it with.
     
  4. Bob

    Bob Well-Known Member

    <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
     
  5. Wuebit

    Wuebit Well-Known Member

    Hey bob :) thanks for the reply am guessing there is some php code which will need to be with that? this is on a custom page nothing to do with xenforo (my booru)
    Cheers
     
  6. ragtek

    ragtek Guest

    Then you would need to include the xf framework (OR create a own xf output, which returns the token and get it via js^^)
    or try to allow the search for guests and set a empty xftoken value
     
    Vodkaholic likes this.
  7. Bob

    Bob Well-Known Member

    lol.. sorry, when you said custom page, I figured you were talking about within the framework :p Follow ragtek's lead..
     
    Vodkaholic likes this.
  8. Wuebit

    Wuebit Well-Known Member

    How can you do it with JS ragtek?
     

Share This Page