PDA

View Full Version : admincp add-in for proxy redirect


newtsys
02-13-2005, 08:37 PM
I have a cript I use that goes into global.php that redirects proxy users, with the exception of aol users. However, to add safe proxy ip addresses one has to have access to root ftp to edit the global.php

I was wondering if there is a possibility to create a template mod and phrase add in that would allow this to be performed in the admincp and add the ip's to global.php($safe_proxies = array) so that a forum admin doesnt need root ftp access?

Below is a c-n-p of said code, any insight would be greatly appreciated.

//this is the site they proxies users will be sent to.
$redirect = "http://www.google.com";

//Custom Function to redirect users
Function redirect_js($url_redirect) {
global $PHP_SELF;
echo "<script language=\"JavaScript\">\n";
echo "<!--\n";
echo "parent.location=\"$url_redirect\";\n";
echo "// -->\n";
echo "</script>\n";
}

// Add the safe proxies in this array

$safe_proxies = array('127.0.0.1','127.0.0.2','192.168.0.1','192.1 68.2.1'); // Safe Proxies

if (( isset($_SERVER['HTTP_FORWARDED']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || isset($_SERVER['HTTP_VIA'])) && !in_array($_SERVER['REMOTE_ADDR'],$safe_proxies) )

{ die(redirect_js($redirect)); }
// identify where we are
define('VB_AREA', 'Forum');


oh and to vbteam, I goofed this should be a request for vb3 section, I apologize

Marco van Herwaarden
02-14-2005, 03:21 AM
You could use a Setting instead.

newtsys
02-14-2005, 06:33 PM
ok, I am no coder, and my php skills are limited to basics, any idea how one would make the setting?

Marco van Herwaarden
02-15-2005, 09:17 AM
Have a look at the thread about manually install HIS hacks by traffix. The basics you can find in there.

newtsys
02-17-2005, 12:33 AM
thank you very much for your help!