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 09-19-2010, 01:34 AM
BigJohnny's Avatar
BigJohnny BigJohnny is offline
 
Join Date: Jun 2006
Location: Canada
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Can you php include a dynamic link?

quick question, can you php include a dynamic link like

PHP Code:
<?php include("index.php?do=something"); ?>
Reply With Quote
  #2  
Old 09-19-2010, 12:48 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm...well, you can request a remote file in various ways (in which case it could be local or remote). Here's a page that describes this: http://www.php-mysql-tutorial.com/wi...using-php.aspx , but I'm guessing that's not what you want since you'd want the external script to execute like it was called by the user that requested *your* page.

You can include a file but it will be executed and will send out an entire HTML page as a result, and that's probably not what you want. [S]And you can't put "?do=something" on it.[/S] (ETA: I was wrong - see later comment)

You could probably adjust the global variables then include a script and capture the output like this:

Code:
$_REQUEST['do'] = 'something'
ob_start();
include('index.php');
$includedphp = ob_get_contents();
ob_end_clean();
but then you'd probably have to do some processing of the resulting string to get what you want.
Reply With Quote
  #3  
Old 09-19-2010, 02:41 PM
BigJohnny's Avatar
BigJohnny BigJohnny is offline
 
Join Date: Jun 2006
Location: Canada
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

heres why I ask, I have a htaccess "mod" that hides robots.txt from everyone but the big 3 robots.

part of this is adding the MIME type to treat the txt as a php file, and at the beginning of robots.txt Ive added the line
Code:
<?php include("index.php?do=something"); ?>
then I've put the "something" call in my index.php file (non vB index)

it appears to work, and when I try and load the robots.txt file in my browser I'm thrown back to the main index......working as it should.

I'm really wondering if the include is loading the entire index.php file, or if it really is just loading that little piece of code to do the bot check.
Reply With Quote
  #4  
Old 09-19-2010, 02:53 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, you know...I just never thought of that, but I was wrong - you *can* put a url in an include statement. I guess I don't know exactly what's going on in your situation.
Reply With Quote
  #5  
Old 09-19-2010, 04:52 PM
BigJohnny's Avatar
BigJohnny BigJohnny is offline
 
Join Date: Jun 2006
Location: Canada
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I didn't want to mention what I was doing in case I "tainted" the responses.

Anyway long story short, It was a shot in the dark and I didn't think it would work, but it does, I just want to know why and/or if I'm doing it right or if it's one of those things that will work but isn't right.

I didn't know a PHP INCLUDE could call a dynamic URL. instead of loading index.php, it seems to actually only call "?do=" code because it works exactly as it should from the human end.

I won't know if it fully works until I open my site and the bots start trying to crawl.
Reply With Quote
  #6  
Old 09-19-2010, 05:22 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, well, I'm not a PHP or vBulletin expert, but there seems to be people here who aren't really programmers who could use a little help. Unfortunately I sometimes embarrass myself by "helping" people who actually know more about this than I do.
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 07:12 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.03797 seconds
  • Memory Usage 2,206KB
  • 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
  • (2)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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