vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How to use print_standard_error() in init.php? (https://vborg.vbsupport.ru/showthread.php?t=78102)

HuangA 03-14-2005 01:12 PM

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!

Zachery 03-14-2005 02:21 PM

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.

HuangA 03-14-2005 04:57 PM

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 :D


All times are GMT. The time now is 01:01 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.01039 seconds
  • Memory Usage 1,728KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete