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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2005, 01:12 PM
HuangA's Avatar
HuangA HuangA is offline
 
Join Date: Jun 2004
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to use print_standard_error() in init.php?

Hi all;
I am on a cPanel box, and I have my forum installed on forums.domain.com, but as we all know, for cPanel boxes, forums.domain is exactly the same as domain.com/forums. Some clever visitors of mine figured that out and started to use that point of presence to access the forum instead. Generally speaking, this does not cause a major problem as it accesses the same DB etc. However, whenever the user tries to login, they get this ugly die('POST requests from foreign hosts are not allowed.'); output with no page decoration what so ever. This poses as a problem for me as I do not wish to have ugly 'debug-look-alike' pages like that sitting around for my visitor...

I did some code probing and found that the message is thrown in init.php; which means any posting request (IE: login, post, reply, edit profile ... etc.) will all throw them the message. I've gone ahead and drafted a quick phrase named "baddomain" as follow
Code:
We cannot allow POST requests from this remote location.  This is placed in to prevent people from hacking / creating extra work load from external locations.  The reason you are seeing this message is most likely because of an error in linking on our part, please do not take this message offensively.  Please try your action again by doing so <a href="$vboptions[bburl]/index.php?$session[sessionurl]">here</a>!
... and modified the die('POST requests from foreign hosts are not allowed.'); to ...
Code:
			require_once('./includes/functions.php');
			eval(print_standard_error('error_baddomain'));
			die('');
However, I am guessing there might be some other templating stuff that I am missing out as simply doing so does not return anything at all. I get a blank screen with no output what-so-ever. So, if anyone is familiar with coding such, I'd be greatly appreciated if you can tell me how to make use of the function print_standard_error() in init.php so it outputs the error page as it would in any other vb page.

Thanks in advance!
Reply With Quote
  #2  
Old 03-14-2005, 02:21 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by HuangA
Hi all;
I am on a cPanel box, and I have my forum installed on forums.domain.com, but as we all know, for cPanel boxes, forums.domain is exactly the same as domain.com/forums. Some clever visitors of mine figured that out and started to use that point of presence to access the forum instead. Generally speaking, this does not cause a major problem as it accesses the same DB etc. However, whenever the user tries to login, they get this ugly die('POST requests from foreign hosts are not allowed.'); output with no page decoration what so ever. This poses as a problem for me as I do not wish to have ugly 'debug-look-alike' pages like that sitting around for my visitor...

I did some code probing and found that the message is thrown in init.php; which means any posting request (IE: login, post, reply, edit profile ... etc.) will all throw them the message. I've gone ahead and drafted a quick phrase named "baddomain" as follow
Code:
We cannot allow POST requests from this remote location.  This is placed in to prevent people from hacking / creating extra work load from external locations.  The reason you are seeing this message is most likely because of an error in linking on our part, please do not take this message offensively.  Please try your action again by doing so <a href="$vboptions[bburl]/index.php?$session[sessionurl]">here</a>!
... and modified the die('POST requests from foreign hosts are not allowed.'); to ...
Code:
			require_once('./includes/functions.php');
			eval(print_standard_error('error_baddomain'));
			die('');
However, I am guessing there might be some other templating stuff that I am missing out as simply doing so does not return anything at all. I get a blank screen with no output what-so-ever. So, if anyone is familiar with coding such, I'd be greatly appreciated if you can tell me how to make use of the function print_standard_error() in init.php so it outputs the error page as it would in any other vb page.

Thanks in advance!
I don't believe print_stadnard_error is avaible in that file.
Reply With Quote
  #3  
Old 03-14-2005, 04:57 PM
HuangA's Avatar
HuangA HuangA is offline
 
Join Date: Jun 2004
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, it is not available by default; hence why I had to come here to ask and leave that post of mine unanswered on .com

Ultimately, I'd like to some how use that function to throw a more user friendly error message for the visitors, and as things stand right now, I don't see it happening. Do you have any experience with making it work? Hm.. idea flash... I wonder if I can just create a custom page using vbulletin's skinning system etc. and redirect it there instead... I'll give that a try now I guess...

thanks

There we go, I took out the line where it said die('POST....'); and replaced it with header("HTTP/1.0 301 Moved Permanently"); and header("Location http://url/baddomain.php"); where baddomain.php is just a page presenting the error message, and everything works great now
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:25 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.03926 seconds
  • Memory Usage 2,187KB
  • Queries Executed 13 (?)
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
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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