The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Search Form on Non-VBulletin Page How-To?
The below code works great for guests, but what is the code to get it to work if you're logged in (and/or not logged in)? It appears to be an issue with the securitytoken, receiving this message if logged in: Your submission could not be processed because you have logged in since the previous page was loaded.
CODE WORKS GREAT, EXCEPT IF LOGGED IN: =========== <form action="/forums/search.php?do=process" method="post"> <div> <input type="hidden" name="do" value="process" /> <input type="hidden" name="quicksearch" value="1" /> <input type="hidden" name="childforums" value="1" /> <input type="hidden" name="exactname" value="1" /> <input type="hidden" name="s" value="" /> <input type="text" id="query" name="query" tabindex="1001" class="text" /> <input type="submit" class="button" tabindex="1004" value="Search Forums" class="searchbut" /> <input type="hidden" name="securitytoken" value="guest" /> <input type="hidden" name="showposts" value="1" id="rb_nb_sp0" tabindex="1002" /> </div> </form> ====== Thanks for any feedback you can provide. |
#2
|
|||
|
|||
saw your thread on .com
really all you need to include is PHP Code:
Here's a guide https://vborg.vbsupport.ru/showthread.php?t=228112 from your post over there I think you'll have no major probs. Good Luck. |
#3
|
|||
|
|||
This is exactly what I was looking for, however it does not seem to work.
No luck with either of these: $vbulletin->userinfo['securitytoken'] $bbuserinfo[securitytoken] Am I calling the variable wrong? Echo should output these, correct? As soon as I get results from either of these using the global.php or whatever it is, I can modify my code below with possibly an if/else "guest". <?php chdir ('/home/username/public_html/forums'); require_once('./global.php'); ?> <form action="/forums/search.php?do=process" method="post"> <div> <input type="hidden" name="do" value="process" /> <input type="hidden" name="quicksearch" value="1" /> <input type="hidden" name="childforums" value="1" /> <input type="hidden" name="exactname" value="1" /> <input type="hidden" name="s" value="" /> <input type="text" id="query" name="query" tabindex="1001" class="text" /> <input type="submit" class="button" tabindex="1004" value="Search Forums" class="searchbut" /> <input type="hidden" name="securitytoken" value="<?php echo $bbuserinfo[securitytoken] ?>" /> <input type="hidden" name="showposts" value="1" id="rb_nb_sp0" tabindex="1002" /> </div> </form> This will ultimately end up within a Wordpress text widget. Maybe the global.php variables are sent via headers only, causing problems...? |
#4
|
||||
|
||||
You may only use those variables if you have included global.php somewhere in the script prior to try to use them.
|
#5
|
|||
|
|||
Indeed. Which is why I tried it this way. Unfortunately neither worked. The global.php was included in the above script. Thanks again for the feedback... So close I can taste it.
|
#6
|
|||
|
|||
I've now even taken the code out of Wordpress and trying the most basic test, the securitytoken variable is still empty. If I'm logged in or not, nothing is populated for the security token.
<?php $curdir = getcwd (); chdir('/home/userdirectory/public_html/forums'); require_once('./global.php'); chdir ($curdir); echo "anything yet?!" . $bbuserinfo[securitytoken]; ?> If I can simply check for this cookie using the code above, I'd be happy. If anyone has a solution, please enlighten... I'm hoping not to have to hack vb in order to pull this variable. I would use "guest" always, but unfortunately if logged into VB a standard search on a non-VB page, I receive "Your submission could not be processed because you have logged in since the previous page was loaded.". |
#7
|
||||
|
||||
Try:
echo "anything yet?!" . $vbulletin->userinfo['securitytoken']; |
#8
|
|||
|
|||
Thank you so much Lynne! I knew it had to be something simple...
Unfortunately when adding it into the header of our CMS (WP) I get: Code:
Unable to add cookies, header already sent. File: /home/userdir/public_html/wp-content/themes/newscast/header.php Line: 2 This does work by the way to authenticate on a page outside of VB, but unfortunately tries to send headers again. It even returns "guest" if not logged in: Code:
<?php $curdir = getcwd (); chdir('/home/jamgears/public_html/forums'); require_once('./global.php'); chdir ($curdir); echo $vbulletin->userinfo['securitytoken']; ?> |
#9
|
||||
|
||||
If it's sending the headers again, then perhaps you are including global.php twice.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|