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 11-29-2005, 07:19 PM
vedman vedman is offline
 
Join Date: Jul 2005
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need help with sessions not being recorded on non-VB pages (3.5.1)

I kinda doubt that this issue is common, but I'm hoping someone out there will be able to offer some advice. My problem deals with sessions, and probably requires a solid familiarity with vbulletin 3.5.x code.

I have a website that is partially integrated with my forums. The forums are located at "/forums"; the main site and all of its pages are located at "/". I want users to be signed in all over the entire site, so I have this code in the header of all pages outside of the forums.

PHP Code:
chdir('forums/');
require_once(
'./global.php');
chdir('../'); 
I have a login box form which passes what it needs, including a redirect value which, after logging the user in, goes back to the page they were on, even outside of the forums. This (and the userid and primary groupid) are really all I make use of with the integration on my non-forum pages.

This has worked just fine for months, on vBulletin 3.5 RCx to 3.5 Gold. I upgraded to 3.5.1 over the weekend, and it still works perfectly .... except for one thing: sessions.

For some reason, now sessions are not being updated in the forums session table when a site visitor (guest OR member) visits a page outside of the forums.

Before the upgrade, the session table was updated whenever a visitor accessed any page with global.php included in it. For example, the session table locations would look something like:

/index.php
/forums/index.php
/forums/poll.php
/contests.php
/index.php
/forums/showthread.php?t=34983
/tourn.php
/contests.php
....etc

I upgrade from 3.5 Gold to 3.5.1, and now my sessions table looks something like:

/forums/index.php
/forums/poll.php
/forums/showthread.php?t=34983
/forums/index.php
/forums/poll.php
/forums/showthread.php?t=34983
...etc.

Pages located outside of the forums should be showing up in the session table... because they are being visited. But, no.

It appears that the session update is being bypassed, but after comparing the changes in class_core, init, global, functions, functions_online, and a couple of other vb pages, I can't figure it out. Out of the few changes that were made in those pages, nothing that would be dependant on the root path of the script has changed, that I saw.

I even backtracked the code from the UPDATE to `session` (I think that's in save(), in class_core.php). After spending hours comparing the updated forum pages to the previous version and making sure my options and plugins are all working, I'm close to giving up.

Can anyone offer any advice? Neither my cookie domain, nor path (nor any other HTTP/cookie settings) changed with the upgrade, but could it still be a cookie thing, or have something do with lastactivity in the cookie?

Much thanks ...
Reply With Quote
  #2  
Old 12-02-2005, 06:32 AM
vedman vedman is offline
 
Join Date: Jul 2005
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nevermind, I found it, finally. Of course, it was a tiny little thing, and to be honest I don't know if it was added to 3.5.1 for security reasons... or... er... hope it's not super important.

init.php, 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))
    {
        
define('NOSHUTDOWNFUNC'true);
    }
    else
    {
        
vB_Shutdown::add('exec_shut_down');
    } 
The php version check at the beginning of the IF statement was added in 3.5.1. That was it ...I'm running PHP 4.

I removed PHP_VERSION < '5' OR , and sessions are once again being recognized (rather, it now gets as far as the database session handling). Sweet.
Reply With Quote
  #3  
Old 12-03-2005, 06:04 PM
Dark Riku Dark Riku is offline
 
Join Date: May 2005
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So what did you put in your header for it to record sessions? Im interested also because i want to put conditionals but the page doesnt reconize the user isnt logged in, even tho its in the header.. so it doesnt work. Any help? thanks
Reply With Quote
  #4  
Old 12-03-2005, 06:15 PM
vedman vedman is offline
 
Join Date: Jul 2005
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is the entirety of the VB integration, placed at the very top in the header of my non-forums pages (which are all located in the root folder of my site). This inclusion, along with the little 3.5.1 hack I mentioned above, will properly update the 'session' table whenever someone visits a page outside of the forums:

PHP Code:
//Require backend:
chdir('forums/');
require_once(
'./global.php');
chdir('../'); 
Then I use $vbulletin throughout the site, for the userid (if $vbulletin->userinfo['userid'] >= 1, visitor is a logged-in member), username, group id ... determining member/group restrictions, etc.

Oh and I don't define THIS_SCRIPT there, because I don't use any of vBulletin's templating or WOL... or anything else except the $vbulletin data. So.. your mileage may vary.
Reply With Quote
  #5  
Old 12-03-2005, 11:06 PM
Dark Riku Dark Riku is offline
 
Join Date: May 2005
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well im my site, im using this for a comment system. I put it above the form box and used else statement. But even if the user is logged in or not, it still shows the else.
I havethe header in an include. So its on a different page. Could this be why i am having this problem?

Tested out the code you sent me and it the same for logged in and logged out... Ill try puting the include in the news page also... although ive tried that before
Reply With Quote
  #6  
Old 12-04-2005, 01:01 AM
vedman vedman is offline
 
Join Date: Jul 2005
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dark Riku
Well im my site, im using this for a comment system. I put it above the form box and used else statement. But even if the user is logged in or not, it still shows the else.
I havethe header in an include. So its on a different page. Could this be why i am having this problem?
Nah, having an included header wouldn't affect it. It sounds like you might have a cookie issue.

Here are a few things you could check. I am assuming your forum installation is located at http://www.yourdomain.com/forums, and you are running vBulletin 3.5.x).

1. Make sure in your vBulletin options, your cookie path is "/", and cookie domain is ".yourdomain.com" (notice the initial period -- this is crucial if you have any subdomains, but doesn't hurt otherwise).

2. Let's say your header is "header.php". It might look something like this:
PHP Code:
 
<?php
//Require backend:
chdir('forums/');
require_once(
'./global.php');
chdir('../');

$userid $vbulletin->userinfo['userid'];
$username $vbulletin->userinfo['username'];
?>

<html>
<head>
<title>blah</title>
</head>

<body>
3. Let's say your main page is "index.php". It might look like this:
PHP Code:
 
<?php
include "header.php";

if (
$userid 0){
      echo 
'Welcome, ' $username '!';
}else{
      
// display login form here
}

// assuming you have a footer include as well....
include "footer.php";
?>
Hope that helps.
Reply With Quote
  #7  
Old 12-04-2005, 07:20 PM
Dark Riku Dark Riku is offline
 
Join Date: May 2005
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

k cool, ill try that out

Nope... when i changed the cookie domain to my site, it woudltn let me log out on any page. My forum domain is /forum/ ... when I made the else say Not logged in and it says it again for logged in and out

If you have aim, my aim is balla1088 is you want to help.
Reply With Quote
  #8  
Old 12-04-2005, 07:48 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

/forum/ is not a domain but a directoryname.
Reply With Quote
  #9  
Old 12-04-2005, 08:48 PM
Dark Riku Dark Riku is offline
 
Join Date: May 2005
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I no that, im just stating that. I just used the suggested one, + that is what he told me to use. the .sitename.com
Reply With Quote
  #10  
Old 12-06-2005, 01:14 AM
Dark Riku Dark Riku is offline
 
Join Date: May 2005
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To add to this, the condition in the header, for the login, work fine. I have if and else for guest and members...

EDIT: Well i narrowed this down to the only reason this is because of the script im using... im trying to find a way around this. I am using a news script, and its all one page, with alot of mysql calls, and i think the includes on this page is screwing up the forum login sessions... Any help?

Yay, found a way around, i had to call out information from the cookie stored by $_COOKIE['bbuserid'] then to get username i just called out the information by basic db connection instead of the include of 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 10:10 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.04587 seconds
  • Memory Usage 2,282KB
  • 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
  • (5)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete