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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-24-2002, 04:58 AM
Martin CX Martin CX is offline
 
Join Date: Nov 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Using vB data in another script...

We're running two BB systems on our site; a vB and a proprietary board with threading. If vB3 ever arrives we'll close the proprietary board down but until then I'm looking at ways of making the change more gradual for our users.

What I am working on is using the vB member info in the proprietary board (prop board) so that users have to login before using the prop board.

Granted, I'm a newbie when it comes to PHP scripting, but this is a bit more frustrating than I thought it would be.

I know I have to require the global.php, but as this is in another subdirectory than the rest of the props board (as in root/forum1 where the other is in root/forum2), I'm not sure how to go about doing it in the best if I use chdir ("../forum2/"); do I need to chdir("../forum1/") back before continuing with the script?

When I c'n'p'ed a small script from another thread (forgot which) just to test it:
PHP Code:
if_($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];
echo 
"Welcome_back, <b>$username</b>"
I got parse errors, but are they related to a failed require of global.php or have I missed a typo?

Ir's rather early - local time - and I haven't really slept, so I'm probably just missing something very basic, but it would really make my day, if one of you could push me in the right direction here.

Thanks,

Martin

P.S: I know of the (two) hacks, but I'm not interested in those, but I'm not really looking for any large-scale solutions. I just need to get these kinks ironed out.
Reply With Quote
  #2  
Old 07-24-2002, 07:02 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
<?php
error_reporting
(7);
chdir('/home/user/htdocs/forums');
require(
'./global.php');

if (
$bbuserinfo['userid'] != 0) {
    
$username $bbuserinfo['username'];
    echo 
"Welcome back, <b>$username</b>.";
}

?>
Change the path in the chdir() function to the real one.
Reply With Quote
  #3  
Old 07-24-2002, 09:56 AM
Martin CX Martin CX is offline
 
Join Date: Nov 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It still won't do as I want it to, though. The same parse errors. I'm almost certain I've got the path right (this time).
Reply With Quote
  #4  
Old 07-24-2002, 10:05 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There are no errors with that script. Make sure you are uploading in ASCII mode and using a normal text editor (i.e not Word).
Reply With Quote
  #5  
Old 07-24-2002, 10:51 AM
Martin CX Martin CX is offline
 
Join Date: Nov 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is the message I'm given:

Parse error: parse error in /home/yada/yada-yada/yada/head.php on line 71

Line 71 is the line with the if-statement:
PHP Code:
<?php
error reporting
(7);
chdir('/home/yada/yada-yada/forums');
require(
'./global.php');
if (
$bbuserinfo['userid'] != 0) {
$username $bbuserinfo['username'];
echo 
"Welcome_back, <b>$username</b>.";
} else {
echo 
"Please log in."

?>
Reply With Quote
  #6  
Old 07-24-2002, 11:04 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Your error is before my code, then. What is the full file?
Reply With Quote
  #7  
Old 07-24-2002, 11:04 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you an Opera or Mac user?

Take a look at your "if" line in your first message: There is an alien char right after if in your code. Opera browser converts spaces to some alien chars when you copy paste it from your browser screen. So try these:

a) Delete all space chars from your code and rewrite them by pressing SPACE button.

b) Do not copy/paste, write the section by hand.

c) Get IE or netscape!
Reply With Quote
  #8  
Old 07-24-2002, 11:07 AM
Martin CX Martin CX is offline
 
Join Date: Nov 2001
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I AM using Opera. (And quite a happy one - usually ) Thank you for your suggestion, I'll try. (fingers crossed)
Reply With Quote
  #9  
Old 07-25-2002, 09:13 AM
wooolF[RM]'s Avatar
wooolF[RM] wooolF[RM] is offline
 
Join Date: Jan 2002
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

]
Quote:
Originally posted by FireFly
PHP Code:
<?php
error_reporting
(7);
chdir('/home/user/htdocs/forums');
require(
'./global.php');

if (
$bbuserinfo['userid'] != 0) {
    
$username $bbuserinfo['username'];
    echo 
"Welcome back, <b>$username</b>.";
}

?>
Change the path in the chdir() function to the real one.
I have tried to use this code as block on a phpNuke...
Result:
Code:
Parse error: parse error, unexpected T_STRING in /home/wooolf/WWW/phpnuke/themes/OceanBlue/theme.php(358) : eval()'d code on line 2
where line 358 is :
PHP Code:
eval($content);} 
in this code:
PHP Code:
// Now We Can Incluse Any PHP Scripts
        if (substr($content,0,2) != "<?")
        echo $content;
           else { $content = str_replace ("<?", "", $content);
        eval($content);}
        echo "</td>\n"
//End Of Hack
Reply With Quote
  #10  
Old 07-25-2002, 09:19 AM
wooolF[RM]'s Avatar
wooolF[RM] wooolF[RM] is offline
 
Join Date: Jan 2002
Posts: 524
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

]I have also tried to use this script:
PHP Code:
<?php include('http://www.blabla.com/forum/welcome.php');?>
which gave the same error...

IS it possible to use vB data on pages outside of the /forum folder? I'm mostly interested in including php files as I amde 3-4 of them and thought it willl work, but I jest get errors...
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:39 AM.


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.04813 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_code
  • (7)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete