Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 08-31-2007, 12:55 PM
mihai11 mihai11 is offline
 
Join Date: Dec 2005
Location: Sibiu - Romania
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How do I pass the session ID in URL only when the user has cookies disabled ?

Hi,

I developed a custom page and I have a bit of a problem with users that have cookies disabled. When such users are visiting my custom page they get logged out automatically (because I am not passing the session ID variable to my custom page).

What is the best way to achieve this ? Should I look for the session ID in the URL – practically check the GET input for the session ID and if I find it then passed it along ?

This kind of stuff must be done everywhere in VB. I mean, each page normally should check from where the session ID is coming then alter the URLs on the page itself accordingly. I mean, let's suppose that the page contains some links for some places on the forum.

When cookies are enabled, the links will look like this:

<a href=”http://www.test.com/test1.php”> Test1 </a>
<a href=”http://www.test.com/test2.php”> Test2 </a>

OTOH, when cookies are disabled, the links will look like this:

<a href=”http://www.test.com/test1.php?s=dwef43r43drf43xsd4d43”> Test1 </a>
<a href=”http://www.test.com/test2.php?s=dwef43r43drf43xsd4d43”> Test2 </a>

How do I do the same in my own code ?

Regards,
Razvan
Reply With Quote
  #2  
Old 08-31-2007, 02:12 PM
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Location: Vineland, NJ
Posts: 6,693
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

within templates, the session id is added via
$session[sessionurl] or $session[sessionurl_q]

within files
$vbulletin->session->vars['sessionurl'] OR $vbulletin->session->vars['sessionurl_q']

I suggest reviewing templates/files for examples
Reply With Quote
  #3  
Old 08-31-2007, 02:19 PM
mihai11 mihai11 is offline
 
Join Date: Dec 2005
Location: Sibiu - Romania
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Princeton View Post
within templates, the session id is added via
$session[sessionurl] or $session[sessionurl_q]

within files
$vbulletin->session->vars['sessionurl'] OR $vbulletin->session->vars['sessionurl_q']

I suggest reviewing templates/files for examples
What is the difference between "sessionurl" and "sessionurl_q" ?

And most important: how do I know when to pass the variables in the URL ? There must be a way to know if the user has cookies enabled or disabled.

In some places I also found a third version:

Code:
$vbulletin->session->vars['sessionurl_js']
What is this version good for ?


Regards,
Razvan
Reply With Quote
  #4  
Old 08-31-2007, 02:28 PM
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Location: Vineland, NJ
Posts: 6,693
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

vbulletin will know when to use it

['sessionurl'] with query such as .php?SESSIONdo=examples
['sessionurl_Q'] without query such as .phpSESSION
Reply With Quote
  #5  
Old 08-31-2007, 02:37 PM
mihai11 mihai11 is offline
 
Join Date: Dec 2005
Location: Sibiu - Romania
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Princeton View Post
vbulletin will know when to use it
Basically, you are saying to append this string and VB will populate it when needed. Is that correct ?

Quote:
Originally Posted by Princeton View Post
['sessionurl'] with query such as .php?SESSIONdo=examples
['sessionurl_Q'] without query such as .phpSESSION
I am not sure what you mean here: use 'sessionurl' when more variables will follow in the URL and use 'sessionurl_Q' when the session itself is the only variable in the URL ?

Practically, the difference between the 2 is an "ampersand" and the end of the string. Is this correct ?
Reply With Quote
  #6  
Old 08-31-2007, 02:42 PM
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Location: Vineland, NJ
Posts: 6,693
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

that is correct

the difference between the 2 is that ? gets added when no query is available
I suggest reviewing your templates and files for examples .. you can also test by disabling cookies in your browser.
Reply With Quote
  #7  
Old 08-31-2007, 02:48 PM
mihai11 mihai11 is offline
 
Join Date: Dec 2005
Location: Sibiu - Romania
Posts: 199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Princeton View Post
that is correct

the difference between the 2 is that ? gets added when no query is available
I suggest reviewing your templates and files for examples .. you can also test by disabling cookies in your browser.
I already did what you suggested. The difference is as follows:

sessionurl = "s\=efeb241f3590c1f98a31deaa78501d5a&"
sessionurl_Q = "?s\=efeb241f3590c1f98a31deaa78501d5a"

So, the difference is in both an ampersand and and question mark (&?).

What about "sessionurl_js". When should I use that ?
Reply With Quote
Reply

Thread Tools
Display Modes

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 02:10 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02397 seconds
  • Memory Usage 2,223KB
  • Queries Executed 13 (?)
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
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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_postinfo_query
  • fetch_postinfo
  • 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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete