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 08-15-2008, 10:27 PM
megatrue megatrue is offline
 
Join Date: Jul 2008
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Howto include() my.php in Vbulletin if no output Display

I have a php script, it needs to included at the very PHP script this Vbulletin.

Code:
<IfModule mod_php5.c>
   php_value auto_prepend_file "/my.php"
</IfModule>
but this script can't get _SERVER["REMOTE_ADDR"], only if i tun register_globals = On
anyone knows, how to fix this problem.
Reply With Quote
  #2  
Old 08-16-2008, 09:52 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$_SERVER['REMOTE_ADDR'] should be available even with register globals turned off. Otherwise some things in vBulletin would also not work.

But if it will work as an auto_prepend_file like you are trying i don't know.
Reply With Quote
  #3  
Old 08-16-2008, 11:55 AM
megatrue megatrue is offline
 
Join Date: Jul 2008
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Marco van Herwaarden View Post
$_SERVER['REMOTE_ADDR'] should be available even with register globals turned off. Otherwise some things in vBulletin would also not work.

But if it will work as an auto_prepend_file like you are trying i don't know.
Thanks for response

shown me please simply way to inculude() my.php at the very PHP script this Vbulletin and get $_SERVER['REMOTE_ADDR'].

I have a test script geschieben. It can get $_SERVER['REMOTE_ADDR'].
in browser: http://mysite.com/test.php

test script:

Code:
 <?php
$ip = $_SERVER['REMOTE_ADDR'];
echo "$ip";
?>
but if 'require_once('my.php')' filled in showthread.php throw errors.

Code:
PHP Notice:  Undefined index:  REMOTE_ADDR in my.php on line XX
Why??

i have read
http://www.vbulletin.com/docs/html/t..._externalfiles
if i want only to run a php script at top of every php script this vbulletin.
It is nothing with output Display.
below code is correct for this thing? Howto test it?

Create a Plug-in for global_start
Code:
ob_start();
require_once(DIR.'my.php');
ob_end_clean();
Reply With Quote
  #4  
Old 08-17-2008, 03:52 AM
MoT3rror MoT3rror is offline
 
Join Date: Mar 2007
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well for one this line will output $ip not xx.xx.xx.xx.
PHP Code:
echo '$ip'
Also if you are including the file at the global_start hook you can use IPADDRESS constant for the user IP address.

You might just have found a bug in PHP with php_value auto_prepend_file so you report the bug and see what the PHP developers say.
Reply With Quote
  #5  
Old 08-17-2008, 11:20 AM
megatrue megatrue is offline
 
Join Date: Jul 2008
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MoT3rror View Post
Well for one this line will output $ip not xx.xx.xx.xx.
PHP Code:
echo '$ip'
Also if you are including the file at the global_start hook you can use IPADDRESS constant for the user IP address.

You might just have found a bug in PHP with php_value auto_prepend_file so you report the bug and see what the PHP developers say.
my fool, I have corrected. in my test.php is echo "$ip";
thank you for response.
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 04:26 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.03757 seconds
  • Memory Usage 2,204KB
  • 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
  • (4)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (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