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(CURDIR, getcwd());
$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.