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

Reply
 
Thread Tools Display Modes
  #1  
Old 05-28-2007, 07:56 PM
MoB Dudditz MD MoB Dudditz MD is offline
 
Join Date: Dec 2006
Location: IL
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default sessionurl question

Can anyone tell me the difference between
$session[sessionurl]
and
$session[sessionurl_q]
?

Or point me in the direction of any information regarding these.
I have had random logout issues and wondering if these are the cause
being improperly added to my forum urls.
Reply With Quote
  #2  
Old 05-28-2007, 08:00 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

link.php?$session[sessionurl]do=something
renders it as

link.php?do=something
link.php?s=(sid)&do=something

So that one ends with an ampersand, and requires the query string to be started (?) on the left.

link.php$session[sessionurl_q]

renders as

link.php
link.php?s=(sid)

so this one is for links that have no query string - it will start it automatically, and won't add the extra ampersand on the end.
Reply With Quote
  #3  
Old 05-29-2007, 12:44 AM
MoB Dudditz MD MoB Dudditz MD is offline
 
Join Date: Dec 2006
Location: IL
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are there certain links required to have one?
Such as the login.php or the private.php?

I have had complications with certain login abilities on
non-forum pages, especially through vBadvanced,
such as random logouts.
Reply With Quote
  #4  
Old 05-29-2007, 12:51 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The idea is if the user has cookies disabled, it will continue to keep them logged in.

If people are experiencing the random logouts, ask them if they have cookies enabled.
Reply With Quote
  #5  
Old 05-29-2007, 01:46 AM
DJiMPaCT DJiMPaCT is offline
 
Join Date: Aug 2002
Location: Vancouver, Canada
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks
Reply With Quote
  #6  
Old 05-29-2007, 01:53 AM
MoB Dudditz MD MoB Dudditz MD is offline
 
Join Date: Dec 2006
Location: IL
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That explained alot.Thanks.
I'll have to back track my amateur coding technique and fix some links.
TY
Reply With Quote
  #7  
Old 11-26-2008, 02:52 AM
jerx jerx is offline
 
Join Date: Feb 2006
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you need to add the sessionurl to every link?

It looks like mod authors do not use it on links within their mods. Does it have good reason or did they forget it?

I think that some vb links do not have sessionurl either, eg the archive link in the footer. Why does that link not have the sessionurl?

How about links to external scripts? I assume it is incorrect to put sessionurl to those links, right? How about links to bridged scripts? I have bridged vb to coppermine gallery and coppermine checks if a user has logged into vb. Since using cookies had some issues, the bridge now extracts the session directly from the vb table.
Reply With Quote
  #8  
Old 11-26-2008, 03:37 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jerx View Post
Do you need to add the sessionurl to every link?
Yes, any page that uses the vBulletin engine.
Quote:
Originally Posted by jerx View Post
It looks like mod authors do not use it on links within their mods. Does it have good reason or did they forget it?
People forget - or they don't know in the first place.
Quote:
Originally Posted by jerx View Post
I think that some vb links do not have sessionurl either, eg the archive link in the footer. Why does that link not have the sessionurl?
Because there is no need for the session to carry over to the archive.
Quote:
Originally Posted by jerx View Post
How about links to external scripts? I assume it is incorrect to put sessionurl to those links, right?
Yes, because only the vBulletin engine uses it.
Quote:
Originally Posted by jerx View Post
How about links to bridged scripts? I have bridged vb to coppermine gallery and coppermine checks if a user has logged into vb. Since using cookies had some issues, the bridge now extracts the session directly from the vb table.
It will initiate the vBulletin engine somewhere in there, so yes.
Reply With Quote
  #9  
Old 11-26-2008, 04:33 AM
jerx jerx is offline
 
Join Date: Feb 2006
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you very much for your quick and thorough reply!

I have some more questions. How do you determine if a link needs the sessionurl?

I think the bridge to coppermine does not initiate the vb engine. The aim of the bridge file was to connect to vb without "touching" the forum, meaning change any setting, change anything in the vb database tables or files. The original bridge file used the vb session cookie to recognize logged in users. This did not work 100%, because when the browser was closed and the user visited the gallery without entering the forum first, the user was classified as guest.

The original cookie code looked like this:
Code:
	// definition of how to extract id, name, group from a session cookie
	function session_extraction()
	{
		if (isset($_COOKIE[$this->cookie_name . 'sessionhash'])) {
			$session_id = addslashes($_COOKIE[$this->cookie_name . 'sessionhash']);
			
			$sql = "SELECT u.{$this->field['user_id']}, u.{$this->field['password']}, u.{$this->field['grouptbl_group_id']}+100 AS usergroupid FROM {$this->usertable} AS u, {$this->sessionstable} AS s WHERE s.{$this->field['user_id']}=u.{$this->field['user_id']} AND s.sessionhash='$session_id'";
			
			$result = cpg_db_query($sql, $this->link_id);
			
			if (mysql_num_rows($result)){
				$row = mysql_fetch_array($result);
				return $row;
			} else {
			    return false;
			}
		}
	}

	// definition of how to extract an id and password hash from a cookie
	function cookie_extraction()
	{
		return false;
	}

Now the direct session extraction from the vb db looks like this:

Code:
	function cookie_extraction()   {
		if (isset($_COOKIE[$this->cookie_name . 'userid'])) {
			$userFromCookie_id = addslashes($_COOKIE[$this->cookie_name . 'userid']);

			$sql = "SELECT u.{$this->field['user_id']}, u.{$this->field['password']}, u.{$this->field['grouptbl_group_id']}+100 AS usergroupid FROM {$this->usertable} AS u WHERE u.userid='$userFromCookie_id'";

			$result = cpg_db_query($sql, $this->link_id);

			if (mysql_num_rows($result)){
				$row = mysql_fetch_array($result);
				return $row;
			} else {
				return false;
			}
		}
	}
I think that therefore you do not have to add sessionurl to the gallery link, do you?

But I like to enhance the bridge. If users only enter the gallery a session should be stored, too, so that they won' t face the problem of being logged out in the middle of viewing the gallery and also to be able to display people in the gallery in who is online.

I think to achieve that you have to initiate the vb engine (eg by calling global.php) and linking with sessionurl should be mandatory again.
Reply With Quote
  #10  
Old 11-26-2008, 04:42 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The correct way to use vBulletin's authentication system is to check the session hash (the first method) and update the session. The session hash is stored as a cookie. When cookies are disabled, it is passed along to every file through "sessionurl", hence the need for it.
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 05:25 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.05457 seconds
  • Memory Usage 2,257KB
  • 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
  • (2)bbcode_code
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • 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