Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-23-2012, 02:43 PM
josh_krz josh_krz is offline
 
Join Date: Feb 2012
Location: United Kingdom
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Using sessions or cookies from vBulletin

I was just wondering if it is possible to use cookies or sessions from vBulletin on a non vB page on my website.

I would like to disable a webpage to people in a certain usergroup, is this possible?

Ideally I would like to use template variables with my vB header etc. but every solution I come across just seems so overly complicated.

Thank you.
Reply With Quote
  #2  
Old 08-23-2012, 02:49 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'd have to do something like this: https://vborg.vbsupport.ru/showthread.php?t=228112 . If your non-vb pages are php, then you might be able to include global.php without doing everything that that article shows (if you just wanted the user's group, for instance). But if you mean html pages, then you'd have to create a php page like is shown in that article, and either put in php code to read your html file and return it (after checking the user's group), or else put your html in a template. (I hope this makes some sense - please ask for clarification if it doesn't )
Reply With Quote
Благодарность от:
josh_krz
  #3  
Old 08-23-2012, 02:58 PM
josh_krz josh_krz is offline
 
Join Date: Feb 2012
Location: United Kingdom
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That article is great, could you elaborate more on using global.php please?

So like, when I include that file, do I just use the template variables as normal or is there a different way of using them?

Thank you.
Reply With Quote
  #4  
Old 08-23-2012, 03:06 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by josh_krz View Post
That article is great, could you elaborate more on using global.php please?
If you did nothing other than include the vbulletin global.php, you'd be able to use $vbulletin to do things like check if the user is logged in or which group they're in. There are a couple of issues: one is that the current directory needs to be the forum directory (the one global.php is in) before you include it, so if your script is in another directory you need to chdir() to the vb directory first. Also, the user will only appear as logged in if the vb cookies are sent, so if your script is outside the vb directory, the vb cookie path needs to be set to '/' or else it will always look like the user is a guest.


Quote:
So like, when I include that file, do I just use the template variables as normal or is there a different way of using them?
I'm not quite sure I follow. I guess it depends on which variables you want. They may be available just by including global.php, or you might need to find the code that calculates them. I'm also not sure if you mean you want to use templates, or if you just want the info in the variables. If you want to use templates, you probably should just use what's shown in that article as a guide.
Reply With Quote
  #5  
Old 08-23-2012, 03:12 PM
josh_krz josh_krz is offline
 
Join Date: Feb 2012
Location: United Kingdom
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry I explained it in a bad way.

What I mean is will I be able to use <vb:if condition="$vboptions['enablesearches']"> inside that PHP file?

Or do you use it like so;

if ($vboptions['enablesearches'] == true{
//Show search bar;
}
Reply With Quote
  #6  
Old 08-23-2012, 03:15 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could use this:

Code:
if ($vbulletin->options['enablesearches'] == true){
//Show search bar;
}

To be honest I'm not sure about $vboptions - it's a shortcut variable equivalent to $vbulletin->options that's created for use in templates, but I'm not sure if it's defined outside of a template.
Reply With Quote
  #7  
Old 08-23-2012, 03:19 PM
josh_krz josh_krz is offline
 
Join Date: Feb 2012
Location: United Kingdom
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok thanks, Ill have a go at that and see what's what.
Reply With Quote
  #8  
Old 08-23-2012, 03:23 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, my "edit" above (which I removed) may have been wrong - I'm not sure if you can use $vboptions or not - I'd have to do a test (or maybe someone else will know).
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:17 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.03810 seconds
  • Memory Usage 2,230KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (1)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete