vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Problem execute PHP script plug-in ahead of other Vbulletin php code. PLEASE HELP. (https://vborg.vbsupport.ru/showthread.php?t=200746)

jarosciak 01-05-2009 09:05 AM

Problem execute PHP script plug-in ahead of other Vbulletin php code. PLEASE HELP.
 
Hi everyone,

Upon a customer request, I've created a new plug-in (php script) which based on an ip address, URL forwards people to a different pages of his forum.
(btw. just so you know, upon his instructions, I am unable to use .htaccess mod redirect)

Anyhow, I've referenced this plug-in on a first line of header template and my php script works and does properly redirect visitors, but I experience a very strange behaviour.
Even that my plug-in is a global variable and referenced on a first line of header template, it doesn't execute in a proper sequence, forum always loads first (and completely) and only afterwards person experiences a redirect.

So, how do I execute a php script ahead of any other vbulletin php code?
Please let me know and thanks for your help.

Joe

Dismounted 01-05-2009 10:32 AM

Use init_startup, and kill the script after you set your redirect header.

jarosciak 01-05-2009 01:21 PM

Could you please contemplate a little more on this.
I am not sure I follow. Thanks a lot for your time.
Any more help you could provide, I really appreciate it.

Dismounted 01-06-2009 02:40 AM

Do you know how to use the PHP header() function?

jarosciak 01-06-2009 03:07 AM

This is still the same problem I mentioned before in another thread.
I need to execute php ahead of any other vbulletin php.
How could header() help me?

Dismounted 01-06-2009 03:13 AM

Create a plugin at init_startup. You use header() to set a redirect header. Then call exit(), and there you go.

jarosciak 01-06-2009 10:20 AM

I use hmtl redirect to a different URL using the Meta Refresh Tag.
Does it make any difference to use header?

Dismounted 01-07-2009 04:22 AM

Using header(), you do not need any page output, which fixes your issue.

Bellardia 01-07-2009 05:15 AM

Quote:

Originally Posted by jarosciak (Post 1703128)
I use hmtl redirect to a different URL using the Meta Refresh Tag.
Does it make any difference to use header?

A meta redirect needs the page to at least partially load to function.
PHP header() can redirect the browser somewhere else before any html is loaded, this way you'll notice an instant redirect as dismounted said.

jarosciak 01-07-2009 09:02 AM

Great, just tested it and it works like a charm.
Thank you guys, I really appreciate all your help.


All times are GMT. The time now is 11:48 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.01104 seconds
  • Memory Usage 1,726KB
  • 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
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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