View Full Version : Global.php variables? (trying to call foruminfo)
James T Brock
12-29-2010, 03:06 AM
I'm trying to use this (https://vborg.vbsupport.ru/showthread.php?t=221739) mod on my forums, however I ONLY want it to apply to one specific sub-forum. Currently the mod works by applying this code at the top of the global.php file..
if(file_exists('dnp_fw.php')){require_once('dnp_fw .php');}
How do I make it so that it only calls that script if the user is inside of a specific subforum? Right now I'm trying to use the below code but it's not working, I assume it's because the global.php file doesn't have access to these variables? What do I use instead?
if ($foruminfo[forumid]==XX) {
if(file_exists('dnp_fw.php')){require_once('dnp_fw .php');}
}
Lynne
12-29-2010, 03:15 AM
The mod had you modify the global.php file? You need to look at the code around it and see what variables are used there and if that code is valid there.
You need to ask questions regarding mods in the mod threads. We know nothing about the mods out here in the main forums.
James T Brock
12-29-2010, 03:31 AM
The Author hasn't been online in a few months so I have to figure it out on my own.
Besides, this question isn't neccessarily specific to that particular mod, I just want to know what code to insert into global.php that would allow me to have a script that only applied to a specific subforum. I'm pretty sure this can be done. I can do it inside of templates but the conditionals don't work in PHP files. What are the mirror conditionals for vBulletin .php files? That's what I'm asking here.
At the top of global.php there's a call to clean_array_gpc, I think if you put your code under that you could use $vbulletin->GPC['forumid']. But I guess that only works if a forum was somehow specified. Looking lower down in global.php it looks like if a threadid is specified it gets the forumid from the threadinfo, so you may have to put your code under that to make it work. I guess that could be a problem, if that code's supposed it be inserted at the top of the file (instead of at a hook location) then there's probably a reason.
BirdOPrey5
01-01-2011, 01:43 AM
From the mod description:
DnP Firewall Gateway was designed to stand against the massive DoS attack targeted DnP Network™ few years ago. Upon installed, it has been reducing the severe level of many incidents and preventing my forum from being overload ever since. It also nearly blocks away all the automated bots that come to register for spamming on the forum. The last release was almost 3 years ago and there had never been any update to the MOD. Version 0.3 came with many issues though it was very stable. I decide to give another upgrade and simplify the code a little for another release. Don't hesitate to install DnP Firewall Gateway for your forum and hope you will find it as useful as I do.
There is no way it would do you any good to run it in a specific forum id.
James T Brock
01-01-2011, 10:08 AM
There is no way it would do you any good to run it in a specific forum id.
That mod is incredibly obtrusive and you will lose some normal first-time users. They click a link to the forum, see the gateway page and leave.
I have ONE sub-forum that has issues with automated post-bots, they cause MySQL to over-load several times a day. Having this script working in only that forum and not the entire site would be useful for me. So yes it would do me good to run it in only one forum.
Since I couldn't get this to work, with the help of kh99 (this guy is awesome), I have instead installed CAPTCHA in the particular forum that was causing issues. It doesn't work as well in reducing the server load since the bots still hit the forum but it's better than nothing.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.