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 02-22-2006, 09:23 PM
nicedreams nicedreams is offline
 
Join Date: Jan 2005
Location: Washington DC Metro
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How do you update cookie/session?

How do you update the cookie/session in vb3.5.4 from a non vb page?

Is there a function in vb I can call to update it?

I do not want my users to be logged out of vb when they are browsing other parts of the site outside of vb. I do not want to increase the cookie timeout, nor do I want to use the remember me box. So I want to be able to access the vb cookie/session info and update it so the user isn't timed out if they are in a separate part of the site over the cookie timeout.

Jim
Reply With Quote
  #2  
Old 02-22-2006, 10:34 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just include global.php on your page, all will be handled automatic.
Reply With Quote
  #3  
Old 02-22-2006, 11:17 PM
nicedreams nicedreams is offline
 
Join Date: Jan 2005
Location: Washington DC Metro
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarcoH64
Just include global.php on your page, all will be handled automatic.
That does not work. I called global.php with
PHP Code:
chdir('forums');
require_once(
'global.php'); 
The page loads correctly, so it was able to load and access global. I printed the vbulletin array and it was there.

But just including this file does not update anything with the cookie or session.

I went from the forum home to my page, waited for the cookie to timeout, reloaded my page a few times, then went to the forum home and I was no longer logged in.

Jim

Ok, so I tried to use the vbsetcookie function. I'm not sure how it works, or can find any info about it. But with this entered:
PHP Code:
vbsetcookie('sessionhash'$sessionhash,0); 
It updates the lastactivity and location field in the session table, but it displays an error message of "Unable to add cookies, header already sent."

What does that error message mean? Am I not calling the vbsetcookie function correctly?

Jim
Reply With Quote
  #4  
Old 02-23-2006, 08:31 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To test if it is working, you should do the following:
- Login to your board
- Switch to your page. Keep refreshing the page once in a while, and keep doing this until the cookietimeout has passed.
- Now go back to your board.

PS Is your page and the board on the same domain?
Reply With Quote
  #5  
Old 02-23-2006, 12:50 PM
nicedreams nicedreams is offline
 
Join Date: Jan 2005
Location: Washington DC Metro
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarcoH64
To test if it is working, you should do the following:
- Login to your board
- Switch to your page. Keep refreshing the page once in a while, and keep doing this until the cookietimeout has passed.
- Now go back to your board.

PS Is your page and the board on the same domain?
I said I did that. I made sure I refreshed my page enough so if the cookie was working there, it wouldn't time out. But when I go back to the forums, it had. They are on the same domain. The page is in the root dir above forums.

Does global.php call vbsetcookie when it is included? If it does, how can I check for error messages that are not shown?

Jim
Reply With Quote
  #6  
Old 03-07-2006, 09:06 PM
hidjra hidjra is offline
 
Join Date: Jan 2002
Location: Amsterdam
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by nicedreams
I said I did that. I made sure I refreshed my page enough so if the cookie was working there, it wouldn't time out. But when I go back to the forums, it had. They are on the same domain. The page is in the root dir above forums.

Does global.php call vbsetcookie when it is included? If it does, how can I check for error messages that are not shown?

Jim
There's some changes in init.php regarding the NOSHUTDOWNFUNC. Take a look in init.php. Look for this around line 202.
PHP Code:
if (PHP_VERSION '5' OR ((SAPI_NAME == 'cgi' OR SAPI_NAME == 'cgi-fcgi') AND $vbulletin->options['gzipoutput'] AND strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false)) 
If your on php 4 you need to make some changes to the if statement above, change "PHP_VERSION < '5'" to "PHP_VERSION < '4'" or so. To test things out you can check out the sessions table, look for your own sessions and see if the lastactivity changes when browsing nonvb-pages.

I've had similair problems when trying to include vbuserinfo on nonvb pages. Now everything works fine, but i'm not satisfied. I'm trying to figure out how to include vbuserinfo, update sessions and cookies without including global.php. There is to much complexity in the vb environment and i want to eliminate any overhead by not including/using any more than strictly necessary :disappointed:

Goodluck,
Hidjra
Reply With Quote
  #7  
Old 06-12-2012, 02:59 PM
asmith asmith is offline
 
Join Date: Jun 2006
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I realise I'm digging up a very old thread here but I have this exact problem.

I run my forum (3.8.1) and use the vbulletin authentication for my site.

The majority of the site usage would be pages that are not part of the forum but are authenticated by vbulletin.

My forum is on a domain like this w ww.mydomain.com/forum and my other pages are on a subdomain like this pages.mydomain.com.

I have my session timeout set to 3600 at the moment because browsing through the non-forum pages of my site does not update the session tables.

I have path to save cookies set to /

I have cookie domain set to .mydomain.com

On all my site pages I chdir to forum directory and include global.php but still my sessions table doesn't get updated.

I have taken the extreme measure of including a hidden iframe that loads the forum index inside just to keep the session updated !

I'd appreciate any advice on this please.

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

the session is updated in the shutdown code, which in vb is usually called at the end when the output is generated, so just including global.php isn't enough. I believe if you add a call to exec_shut_down() that should take care of it.
Reply With Quote
2 благодарности(ей) от:
Lynne, tbworld
  #9  
Old 06-12-2012, 03:34 PM
asmith asmith is offline
 
Join Date: Jun 2006
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
the session is updated in the shutdown code, which in vb is usually called at the end when the output is generated, so just including global.php isn't enough. I believe if you add a call to exec_shut_down() that should take care of it.
Excellent !

That did the trick. I've searched these forums and seen many posts regarding this and never found anyone give the solution !

Thanks.
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 11:48 PM.


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.04202 seconds
  • Memory Usage 2,256KB
  • 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
  • (3)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (2)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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
  • 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