Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 05-26-2010, 03:48 PM
ritter10 ritter10 is offline
 
Join Date: Apr 2009
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
If you include global.php in the page at the top, then the username should be available.
look. I tried

PHP Code:
chdir ('../../vbulletin/');
require_once(
'./global.php');  

echo 
"<pre>";
print_r($vbulletin->userinfo);
echo 
"</pre>"
The global variable It's ok. But when I print the data of the $vbulletin->userinfo at my page, I receive this

Quote:
Array
(
[userid] => 0
[usergroupid] => 1
[username] => N?o Registrado (User not registered)
[password] =>
[email] =>
[styleid] => 1
[languageid] => 4
[lastactivity] => 1274807054
[daysprune] => 0
[timezoneoffset] => -3
[dstonoff] => 1
[showsignatures] => 1
[showavatars] => 1
[showimages] => 1
[showusercss] => 1
[dstauto] => 0
[maxposts] => -1
[startofweek] => 1
[threadedmode] => 0
[securitytoken] => guest
[securitytoken_raw] => guest
[options] => 1048647
[lang_options] => 1
[lang_code] => pt-br
[lang_charset] => ISO-8859-1
[lang_locale] =>
[lang_imagesoverride] =>
[lang_dateoverride] =>
[lang_timeoverride] =>
[lang_registereddateoverride] =>
[lang_calformat1override] =>
[lang_calformat2override] =>
[lang_logdateoverride] =>
[lang_decimalsep] => ,
[lang_thousandsep] => .
[lastvisit] => 1274807054
[tzoffset] => -2
[lastvisitdate] => 25-05-2010 15:04
....
}
I can acess the variable, but the information doesn't correspond to my session because at this time I was logged at the forum.

help me! Please
Reply With Quote
  #12  
Old 05-26-2010, 10:44 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you sure you are logged into the forum? Have you checked the session table to verify this?
Reply With Quote
  #13  
Old 05-28-2010, 08:18 PM
ritter10 ritter10 is offline
 
Join Date: Apr 2009
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Are you sure you are logged into the forum? Have you checked the session table to verify this?
I'm logged now. I only can see the forum if I log in.

After the log in I tried again the test page and I receive the same thing!!

look

Quote:
Array
(
[userid] => 0
[usergroupid] => 1
[username] => N?o Registrado
[password] =>
[email] =>
[styleid] => 1
[languageid] => 4
[lastactivity] => 1275079827
[daysprune] => 0
[timezoneoffset] => -3
[dstonoff] => 1
[showsignatures] => 1
[showavatars] => 1
[showimages] => 1
[showusercss] => 1
[dstauto] => 0
[maxposts] => -1
[startofweek] => 1
[threadedmode] => 0
[securitytoken] => guest
[securitytoken_raw] => guest
[options] => 1048647
[lang_options] => 1
[lang_code] => pt-br
[lang_charset] => ISO-8859-1
[lang_locale] =>
[lang_imagesoverride] =>
[lang_dateoverride] =>
[lang_timeoverride] =>
[lang_registereddateoverride] =>
[lang_calformat1override] =>
[lang_calformat2override] =>
[lang_logdateoverride] =>
[lang_decimalsep] => ,
[lang_thousandsep] => .
[lastvisit] => 1275079827
[tzoffset] => -2
[lastvisitdate] => 28-05-2010 18:50
I looked at the session table and my user Id was there.


I don't know what to do.
Reply With Quote
  #14  
Old 05-28-2010, 10:59 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What are the lines you are currently using in your code?

edit: Also, you noted that I said you needed to call global.php AT THE TOP of your page, right? Not in the middle of a script.
Reply With Quote
  #15  
Old 05-29-2010, 05:12 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And you must be on the same cookie domain.
Reply With Quote
  #16  
Old 05-29-2010, 07:36 AM
ritter10 ritter10 is offline
 
Join Date: Apr 2009
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
What are the lines you are currently using in your code?

edit: Also, you noted that I said you needed to call global.php AT THE TOP of your page, right? Not in the middle of a script.
I'm doing it. Top of the page.

PHP Code:
<?php

//chdir ('../../vbulletin/');
require_once('./global.php');  

echo 
"<pre>";
print_r($vbulletin->userinfo);
echo 
"</pre>";
New information:

I put the file at the same forum's folder and I receive the same thing. This is so strange.

Quote:
Array
(
[userid] => 0
[usergroupid] => 1
[username] => N?o Registrado
[password] =>
[email] =>
[styleid] => 1
[languageid] => 4
[lastactivity] => 1275121931
[daysprune] => 0
[timezoneoffset] => -3
[dstonoff] => 1
[showsignatures] => 1
[showavatars] => 1
[showimages] => 1
[showusercss] => 1
[dstauto] => 0
[maxposts] => -1
Quote:
Originally Posted by Marco van Herwaarden View Post
And you must be on the same cookie domain
In the Admin CP the cookie domain was "blank". Are there something wrong? My forum was instaled at public_html/OPS/vbulletin/.


Thanks for help me.
Reply With Quote
  #17  
Old 05-29-2010, 01:31 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I put a page with this exact code into my vb folder:
PHP Code:
<?php

//chdir ('../../vbulletin/');
require_once('./global.php');  

echo 
"<pre>";
print_r($vbulletin->userinfo);
echo 
"</pre>"
?>
And got this:
HTML Code:
Array
(
    [userid] => 1
    [temp] => 
    [field1] => 
    [field2] => 
    [field3] => 
    [field4] => admin
    [field5] => Lynne
    [field6] => Yes
etc
So, the script works. There is something going on on your end that is causing it to not work.
Reply With Quote
  #18  
Old 05-31-2010, 04:56 PM
ritter10 ritter10 is offline
 
Join Date: Apr 2009
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

do you have any idea?

Cookies and HTTP Header Options
Path to Save Cookies: /
Cookie Domain: blank

Are there other place in the admincp where I can see more options/configurations about session and cookies?
Reply With Quote
  #19  
Old 05-31-2010, 09:52 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you aren't putting that page into the vbulletin forums directory, then it isn't going to work as is. You would need to use the chdir line. So, where are you putting it (let's see your directory structure) and then what is your chdir line?
Reply With Quote
  #20  
Old 06-01-2010, 03:29 AM
Tibald Tibald is offline
 
Join Date: Sep 2009
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I also tried this script, all working correctly

I have a question about login with external script - now trying to understand the logic from login.php file... Maybe, anybody can get me advice or code example for login (user authorization) with external script?

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

Quote:
Originally Posted by Lynne View Post
If you aren't putting that page into the vbulletin forums directory, then it isn't going to work as is. You would need to use the chdir line. So, where are you putting it (let's see your directory structure) and then what is your chdir line?
something like this:

Quote:
$dir = getcwd();
chdir(getcwd().'/forum');
include_once('global.php');
chdir($dir);
Reply With Quote
Reply

Thread Tools
Display Modes

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 01:07 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.14064 seconds
  • Memory Usage 2,266KB
  • 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_html
  • (3)bbcode_php
  • (9)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