vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   search not working, security token is invalid. (https://vborg.vbsupport.ru/showthread.php?t=210515)

JonZ 04-07-2009 02:28 AM

search not working, security token is invalid.
 
I try to fix for someone a portal site that use vB as search. It was working before an upgrade from 3.6 to 3.7.3.

Now, search inside the forum is all working fine, but my search fields on my portal are not.

I've been following closely these thread:
https://vborg.vbsupport.ru/showthread.php?t=177013
http://www.vbulletin.com/forum/showp...40&postcount=7


but I haven't found any answer for my portal, i'm still having "Your submission could not be processed because a security token was invalid.". The portal is not using any templates from the ACP, it operating on it own php code with snippets took from vB.

here's what my code looks like:

headerinclude.php
PHP Code:

<?php

define
('CSRF_PROTECTION'true);  
define(CURDIRgetcwd());

$root $_SERVER['DOCUMENT_ROOT'];

chdir($root."\board\\");

require_once(
'./global.php');

CURDIR chdir(CURDIR) : chdir("../");


$theme "/board/".$stylevar["imgdir_misc"];
$themename $style["title"];

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <title>...</title>
    <link href="/board/images/common.css" rel="stylesheet" type="text/css" />
    <link href="<?=$theme?>/style.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="board/clientscript/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="board/clientscript/yui/connection/connection-min.js"></script>
    <script type="text/javascript" language="javascript">
    <!--
        var SESSIONURL = "$session[sessionurl_js]";
        var SECURITYTOKEN = "$bbuserinfo[securitytoken]";
        var IMGDIR_MISC = "$stylevar[imgdir_misc]";
        var vb_disable_ajax = parseInt("$vboptions[disable_ajax]", 10);
    -->
    </script>
    <script type="text/javascript" src="board/clientscript/vbulletin_global.js"></script>
    <script type="text/javascript" src="board/clientscript/vbulletin_menu.js"></script>   
</head>
<body><a name="totop"></a>
<?=$curdir?>


<?php 
    
@include("search.php"); 
?>

search.php
PHP Code:

<fieldset id="newssearch">
    <form action="/board/search.php" method="post">
            
            <input type="hidden" name="do" value="process" />            
            <?php
                $newsForumArray 
explode (",",$newsforumID);
                foreach(
$newsForumArray as $forumid) {
                    echo 
"<input type=\"hidden\" name=\"forumchoice[]\" value=\"".$forumid."\" />\n";
                }
            
?>
            <input type="hidden" name="childforums" value="0" />
            <input type="hidden" name="s" value="$session[sessionhash]" />
            <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
            <label for="newssearch"><span>News Search</span>
            <input type="text" class="textbox" name="query" size="20" />
            </label>
            <input type="submit" class="button" value="Go" />     
    </form>
</fieldset>
<fieldset id="forumsearch">
    <form action="/board/search.php" method="post">
        <input type="hidden" name="do" value="process" />
        <input type="hidden" name="showposts" value="0" />
        <input type="hidden" name="s" value="$session[sessionhash]" />
        <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
        <label for="forumsearch"><span>Forum search:</span>
        <input type="text" class="textbox" name="query" size="20" />
        </label>
        <input type="submit" class="button" value="Go"  />
        <div style="text-align:right;"><a href="/board/search.php">Go Advanced</a></div>
    </form>
</fieldset>


help please and thanks in advance!

--------------- Added [DATE]1239144847[/DATE] at [TIME]1239144847[/TIME] ---------------


found my solution in this thread:

https://vborg.vbsupport.ru/showthrea...=csrf+external

<input type="hidden" name="securitytoken" value="<?php echo($vbulletin->userinfo['securitytoken']); ?>" />

this input solved it for me.


All times are GMT. The time now is 12:27 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01078 seconds
  • Memory Usage 1,735KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete