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

Reply
 
Thread Tools Display Modes
  #11  
Old 09-06-2012, 02:48 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, well, it's getting closer. I think it's possible to do the include in a function, but you have to define some variables as global first. I know $vbulletin is one of them, but I can't remember what the others were. I know user Disasterpiece was trying to do that a while back and I think he finally succeeded.

Edit: here's the thread I was thinking of: www.vbulletin.org/forum/showthread.php?t=274455 . It looks like you also need $bootstrap as global. And it does look like maybe he wasn't completely successful (at least the last time he posted in that thread).
Reply With Quote
  #12  
Old 09-06-2012, 03:05 PM
ohadpartuck ohadpartuck is offline
 
Join Date: Mar 2012
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have change the global.php file like so :

PHP Code:
global $bootstrap;

$bootstrap = new vB_Bootstrap_Forum(); 
but still the same ($vbulletin->userinfo shows not regitered)
Reply With Quote
  #13  
Old 09-06-2012, 03:14 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, sorry for the confusion - those comments were only about being able to include global.php from a function. And BTW, you could put the global statement in your code before it's included, that way you don't need to modify the vbulletin code.

But, if you put your include outside any function you should see the user info, so obviously you still have some other problem. One thing you might do is turn on errors in your custom script, if you haven't already. I think you can put error_reporting(E_ALL) and ini_set('display_errors', 1) at the beginning of your file.

Sorry I'm not a lot of help, but this is a question that's asked periodically, and it's usually the cookie thing.
Reply With Quote
  #14  
Old 09-06-2012, 03:37 PM
ohadpartuck ohadpartuck is offline
 
Join Date: Mar 2012
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1. tried global $bootstrap in the main php file.
2. tried error_reporting(E_ALL) and ini_set('display_errors', 1) - got errors but nothing to do with global.php
3. what do you mean by "and it's usually the cookie thing."? I have checked my browser cookies and I see the relevant cookies - bb_userid , etc...
Reply With Quote
  #15  
Old 09-06-2012, 03:41 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ohadpartuck View Post
3. what do you mean by "and it's usually the cookie thing."? I have checked my browser cookies and I see the relevant cookies - bb_userid , etc...
I just mean that as far as I know, whenever someone asked, changing the cookie path has fixed the problem.

You said you see the cookies - do you have a way to look at the request that's sent to your custom script to see if it includes the cookies? (Edit: or I suppose another way would be to have your custom script check to see if they're set).
Reply With Quote
  #16  
Old 09-06-2012, 03:56 PM
ohadpartuck ohadpartuck is offline
 
Join Date: Mar 2012
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I see that the cookie bb_userid is set in my forum domain but if try to check in the other domain
PHP Code:
isset($_COOKIE['bb_userid']) 
then I don't see the cookie. niether do I see it in the page cookies..

it's weird . aren't cookies suppose to be general for the whole browser?
Reply With Quote
  #17  
Old 09-06-2012, 04:11 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To be honest I don't know a lot about it. But my understanding is that cookies are only sent back to the domain/path that set them (so that you're not letting every site see all your cookies). I believe the script that sets the cookie can modify the cookie to allow it to be sent to other scripts. Here's a paragraph from the Wikipedia article on http cookies:

Quote:
Domain and Path

The cookie domain and path define the scope of the cookie—they tell the browser that cookies should only be sent back to the server for the given domain and path. If not specified, they default to the domain and path of the object that was requested. An example of Set-Cookie directives from a website after a user logged in:


Set-Cookie: LSID=DQAAAK…Eaem_vYg; Domain=docs.foo.com; Path=/accounts; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly
Set-Cookie: HSID=AYQEVn….DKrdst; Domain=.foo.com; Path=/; Expires=Wed, 13-Jan-2021 22:23:01 GMT; HttpOnly
Set-Cookie: SSID=Ap4P….GTEq; Domain=.foo.com; Path=/; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly
......

The first cookie LSID has default domain docs.foo.com and Path /accounts, which tells the browser to use the cookie only when requesting pages contained in docs.foo.com/accounts. The other 2 cookies HSID and SSID would be sent back by the browser while requesting any subdomain in .foo.com on any path, for example www.foo.com/.

Cookies can only be set on the top domain and its sub domains. Setting cookies on www.foo.com from www.bar.com will not work for security reasons.

that brings up another question - are your two sites on the same (top-level) domain? I believe leaving the "cookie domain" setting blank (which seems to be the default) will allow it to be sent to all related subdomains, but if you have an entirely different domain name for your other site, that might be the issue.
Reply With Quote
  #18  
Old 09-06-2012, 06:35 PM
ohadpartuck ohadpartuck is offline
 
Join Date: Mar 2012
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
that brings up another question - are your two sites on the same (top-level) domain? I believe leaving the "cookie domain" setting blank (which seems to be the default) will allow it to be sent to all related subdomains, but if you have an entirely different domain name for your other site, that might be the issue.
as I stated - they are both under s-maof.com
on is
s-maof.com/GoldSig/app
and the other
s-maof.com/Forum

I have set the cookie path to '/' (as you advised) which means the cookies are being sent to s-maof.com.
from your logic - I should be able to see them from s-maof.com/GoldSig/app due to the face that it is a subdomain of s-maof.com.
Reply With Quote
  #19  
Old 09-06-2012, 07:21 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did see in your first post where it looked like they were at the same domain, but thought I'd make sure. You're right, as far as I know the cookies should be sent with the settings you have.

Sorry, maybe someone else will have an idea.
Reply With Quote
  #20  
Old 09-09-2012, 09:01 AM
ohadpartuck ohadpartuck is offline
 
Join Date: Mar 2012
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi kh99,
thank for all your help,
I got it working with
PHP Code:
chdir(FORUM_DIR);
    include 
'./global.php';
    
$arr $vbulletin->userinfo
* It can't be used inside a function for some reason..

It's weird sometimes it worked and sometimes it didn't.
now it workes all the time.

Thanks again


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

damm,
it stopped working again for some reason... It works only on chrome

kh99,
what can be the cause?

it worked fine, recognized me and another user, and now it stopped again..
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:47 AM.


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.04613 seconds
  • Memory Usage 2,261KB
  • 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
  • (3)bbcode_php
  • (3)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
  • (2)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_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