![]() |
Security token with external search field.
Hello,
I copied my original board code to create a search box on my site root and my 404.php page (http://www.mythtvtalk.com and http://www.mythtvtalk.com/404.php). It worked fine for few hours but now, each time I try to use it, I get the following error: Quote:
Do you know how this can be tweaked? Thanks in advance. Ludo |
Dismounted,
Is there a way to generate a security token outside of the forum to use in a search box? I.e. Generate a token on www.domain.com when the forum is at www.domain.com/forum ? Thanks in advance. Ludo |
See the function fetch_userinfo() in functions.php for the algorithm of the security token.
PS. I have moved your post from your other thread into this one. |
You can have access to a users' security token outside of standard forum pages if you include global.php.
PHP Code:
PHP Code:
|
Yes, but doing that may be a bit excessive when you can generate your own token.
|
Quote:
|
Quote:
I can perform searches externaly IF I was not logged in before. If I was already logged in, it looks like my generated security token (using a random user) does not match mine and therefore I hit the error page. Is there a way to check/test if a security token already exists? Because if one already use it, I should use this one instead of generate a new one. I checked the cookie and I can't seem to find the security token in them :/ Any idea? Thanks Ludo |
Security tokens are generated on every page load. You must use the user ID that the user has logged in as (find this in cookies).
|
Erm, so is there a way to know/check if a user is already logged in and if so, to get his userid? (outside of the forum obviously)
And for guest/not-logged in user, which userid and user_Salt should be used? Because there is no guest member defined in the user table Thanks for your help |
Quote:
Quote:
|
Quote:
Oh thanks man, it working! I hit my head on a wall for days on this problem. |
Having the same problem here!
Where does this code go? require_once('./global.php'); print($vbulletin->userinfo['securitytoken']); |
This thread only applies if you are creating your own files - are you doing this?
|
Problem has been solved, thanks for checking in.
This was for a search box outside of the existing ones, so it needed to generate the token. |
Quote:
|
Including global.php will generate a token automatically, otherwise, you can generate one yourself.
|
Thanks for the quick response. I'm trying to do this on a wordpress page. On the appropriate php file for the template sidebar of WP I put this code:
Code:
<?php $vwd = '/home/domains/theybannedme.com/www_root/forums'; |
$bbuserinfo can only be used inside vBulletin templates.
Code:
<input type="hidden" name="securitytoken" value="<?php echo $vbulletin->userinfo['securitytoken']; ?>" /> |
Using this:
Code:
<?php $vwd = '/home/domains/theybannedme.com/www_root/forums'; Quote:
|
View the source of the page - is there a token there?
|
Yes, it has a security token in the source code but it says invalid:
Code:
var SESSIONURL = ""; |
I'm talking about the hidden input...
Code:
<input type="hidden" name="securitytoken" value="SOMETHINGHERE" /> |
This is on the search page:
Code:
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" /> Code:
var SECURITYTOKEN = "LONG STRING OF NUMBERS/LETTERS"; |
Your input field is not correct - the echo statement is wrong. You'll need to play with it... perhaps ". $bbuserinfo['var'] ." ?
|
Quote:
|
Why are you reading the "var SECURITYTOKEN = " bit? That is the vBulletin Javascript, not your input - you need to look at the input's code in the source...
|
Quote:
|
When you've loaded up the page in your browser, view the source, and find this line:
Code:
<input type="hidden" name="securitytoken" value=" |
Quote:
Code:
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" /> |
Quote:
Are you sure you need the full server path to your global.php? Mine is fine copying the example exactly and using: Code:
<?php |
I have read, and I have tried all that is in this thread. Sometimes it work and sometimes it does not.
I am not sure if this thread says it is impossible to solve this security token problem or not. So please, if there is a solution please let me know :-) And if there?s no solution, I would be grateful to learn about that as well. :confused::confused: |
All times are GMT. The time now is 05:26 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|