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

Reply
 
Thread Tools Display Modes
  #1  
Old 04-21-2015, 02:33 PM
Grouper Grouper is offline
 
Join Date: Sep 2013
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom page

I have a custom page outside of the forums that I want to use the vbulletin session / login with. I followed the directions at https://vborg.vbsupport.ru/showthread.php?t=98009 and it seems to be somewhat working, however, even though i am logged into the forums it always returns a userId of 0 and acts as if I am not logged in.

PHP Code:
<?php
chdir
('/home/path/to/forums'); 
require_once(
'./global.php');
if (!
is_member_of($vbulletin->userinfo6,7,5,9,23) ||
    
is_member_of($vbulletin->userinfo8)) 

         
print_no_permission();     
}
I am using nodejs so am using port 3000 on my site. I have the php processor working, just can't seem to get the vbulletin session.

What am I doing wrong?
Reply With Quote
  #2  
Old 04-21-2015, 02:45 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It could be that you need to change the cookie path, in Settings > Options > Cookies and HTTP Header Options > Path to Save Cookies. If you have it set to something below where your custom page is, then the cookie that keeps you logged in will not be sent for your custom page.

Edit: Oh, I don't really understand the nodejs/port 3000 comment you added above. But you need the cookie to be sent or else you need the sessionhash value as a parameter (which is probably difficult to do unless users are getting to the custom page by clicking on a link in another vbulletin page).
Reply With Quote
  #3  
Old 04-21-2015, 07:17 PM
Grouper Grouper is offline
 
Join Date: Sep 2013
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi kh99,

So I am able to get the PHPSESSID from the cookie however setting session_id() to that value is not loading in the signed in user. Is there a different way I should be doing this?
Reply With Quote
  #4  
Old 04-21-2015, 08:35 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, I'm not quite following what you're doing. I guess setting the cookie path to something else isn't an option? When I said the cookie has to be sent, I meant things have to be set up right for the browser to send the cookie when your custom page is requested, or else the url used to access your custom page (clicking a link, a javascript request, or however it's being done) has to have the sessionhash as a parameter (or as a posted field).

But like I said, it could be that I don't understand the situation.
Reply With Quote
  #5  
Old 04-21-2015, 10:37 PM
Grouper Grouper is offline
 
Join Date: Sep 2013
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

kh99,

we are using file sessions in php and we have the forums on our website.com/forums then we are making a nodejs application on website.com:3000 that we want to use the forums account and permissions. While we have access to the cookies on our nodejs application all that we can get is the PHPSESSID because the bb_sessionhash is http only so we cannot read it.

What I have to do is read the cookies with javascript and forward them to a php parser in our nodejs application. So what I am doing is sending over the phpsessionid then setting the session_id() in php hoping it would load in the php session with the users vb account.

--------------- Added [DATE]1429671346[/DATE] at [TIME]1429671346[/TIME] ---------------

kh99,

Ok, i am able to get the bb_sessionhash with $_COOKIE however it doesn't seem to want to read it. Is there a way to force vbulletin to use a bb_sessionhash

--------------- Added [DATE]1429677979[/DATE] at [TIME]1429677979[/TIME] ---------------

Ok, I figured it out. I wasn't using https so the secure cookies were not being read properly by vbulletin
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 08:48 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.03852 seconds
  • Memory Usage 2,198KB
  • 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_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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