- Joined
- Jun 22, 2021
- Messages
- 118
- Points
- 43
Reputation:
fixed issue.
Last edited:
- Joined
- Apr 27, 2019
- Messages
- 368
- Points
- 103
Reputation:
- By Soft4Win
Addon is not working @ENXF NET
Its always keep giving error "Proxy, VPN or Data center IP are not allowed here"
even im not using anything such as vpn or etc.
How im going to disable this addon, i cant acces admin panel?
PHP:
$config['enableListeners'] = false;
↑View previous replies…
BattleKingI have the same problem i see msg after installing addon
"Proxy, VPN or Data center IP are not allowed here"
what should i do?
ilonaHow are you connected?
BattleKingwith real IP, i use cloudflare for my website,
i added this config in Listener.php and the same info about vpn (other users has the same error
ilonadid you also insert that code https://enxf.net/threads/proxy-check.3954/post-30367
BattleKingYes and still the same issue
Whats wrong???
BattleKingtry this code with some debug statements and check what is in REMOTE_ADDR:
BattleKingi have to change "127.0.0.1" for my server IP or?
ilonaNo, check if the IP might be black listed which you get back from the debug statement
- Joined
- Mar 15, 2023
- Messages
- 93
- Points
- 28
Reputation:
- By ilona
Then we can disable the check for admins and moderators, like that and to get the real IP if you are using cloudflare:
PHP:<?php namespace XFDev\ProxyCheck; class Listener { public static function proxyCheck(\XF\Entity\User &$visitor) { if($visitor->user_id != 0) { if (self::proxy_exclude($_SERVER["REMOTE_ADDR"]) == false ) { $ip = self::getUserIP(); $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, 'https://blackbox.ipinfo.app/lookup/'.$ip); $result = curl_exec($ch); curl_close($ch); if($result == 'Y' or $result == 'X'){ if( ($visitor->is_admin || $visitor->is_moderator) == false) { //\XF::dump($visitor); echo "Proxy, VPN or Data center IP ($ip) are not allowed here"; exit(); } } } } } public static function proxy_exclude($ip) { $ip1 = gethostbyname($_SERVER["REMOTE_ADDR"]); $res = false; if($ip1 == '127.0.0.1' || $ip1 == '::1') $res = true; return $res; } public static function getUserIP() { // Get real visitor IP behind CloudFlare network if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) { $_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"]; $_SERVER['HTTP_CLIENT_IP'] = $_SERVER["HTTP_CF_CONNECTING_IP"]; } $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; if(filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } return $ip; } }
"Proxy, VPN or Data center IP are not allowed here"
what should i do?
BattleKing
Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
- Joined
- May 24, 2020
- Messages
- 3,529
- Points
- 523
Reputation:
- By BattleKing
I have the same problem i see msg after installing addon
"Proxy, VPN or Data center IP are not allowed here"
what should i do?
- Joined
- Mar 15, 2023
- Messages
- 93
- Points
- 28
Reputation:
- By ilona
How are you connected?
i added this config in Listener.php and the same info about vpn (other users has the same error
BattleKing
Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
- Joined
- May 24, 2020
- Messages
- 3,529
- Points
- 523
Reputation:
- By BattleKing
with real IP, i use cloudflare for my website,
i added this config in Listener.php and the same info about vpn (other users has the same error
- Joined
- Mar 15, 2023
- Messages
- 93
- Points
- 28
Reputation:
- By ilona
did you also insert that code https://enxf.net/threads/proxy-check.3954/post-30367
Whats wrong???
BattleKing
Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
- Joined
- May 24, 2020
- Messages
- 3,529
- Points
- 523
Reputation:
BattleKing
Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
- Joined
- May 24, 2020
- Messages
- 3,529
- Points
- 523
Reputation:
- By BattleKing
Maybe cloudflare changed something
PHP:
<?php
namespace XFDev\ProxyCheck;
class Listener
{
public static function proxyCheck(\XF\Entity\User &$visitor)
{
if($visitor->user_id != 0)
{
if (self::proxy_exclude($_SERVER["REMOTE_ADDR"]) == false ) {
$ip = self::getUserIP();
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://blackbox.ipinfo.app/lookup/'.$ip);
$result = curl_exec($ch);
curl_close($ch);
if($result == 'Y' or $result == 'X'){
if( ($visitor->is_admin || $visitor->is_moderator) == false) {
echo "Proxy, VPN or Data center IP ($ip) are not allowed here";
exit();
}
}
}
}
}
public static function proxy_exclude($ip) {
$ip1 = gethostbyname($_SERVER["REMOTE_ADDR"]);
$res = false;
if($ip1 == '127.0.0.1' || $ip1 == '::1') $res = true;
return $res;
}
public static function getUserIP()
{
// Get real visitor IP behind CloudFlare network
if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
$_SERVER['HTTP_CLIENT_IP'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}
$client = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote = $_SERVER['REMOTE_ADDR'];
\XF::dump($_SERVER);
if(filter_var($client, FILTER_VALIDATE_IP))
{
$ip = $client;
}
elseif(filter_var($forward, FILTER_VALIDATE_IP))
{
$ip = $forward;
}
else
{
$ip = $remote;
}
return $ip;
}
}
- Joined
- Mar 15, 2023
- Messages
- 93
- Points
- 28
Reputation:
- By ilona
try this code with some debug statements and check what is in REMOTE_ADDR:
PHP:<?php namespace XFDev\ProxyCheck; class Listener { public static function proxyCheck(\XF\Entity\User &$visitor) { if($visitor->user_id != 0) { if (self::proxy_exclude($_SERVER["REMOTE_ADDR"]) == false ) { $ip = self::getUserIP(); $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, 'https://blackbox.ipinfo.app/lookup/'.$ip); $result = curl_exec($ch); curl_close($ch); if($result == 'Y' or $result == 'X'){ if( ($visitor->is_admin || $visitor->is_moderator) == false) { echo "Proxy, VPN or Data center IP ($ip) are not allowed here"; exit(); } } } } } public static function proxy_exclude($ip) { $ip1 = gethostbyname($_SERVER["REMOTE_ADDR"]); $res = false; if($ip1 == '127.0.0.1' || $ip1 == '::1') $res = true; return $res; } public static function getUserIP() { // Get real visitor IP behind CloudFlare network if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) { $_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"]; $_SERVER['HTTP_CLIENT_IP'] = $_SERVER["HTTP_CF_CONNECTING_IP"]; } $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; \XF::dump($_SERVER); if(filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } return $ip; } }
BattleKing
Spirit of darkness
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P Member
Collaborate
Registered
- Joined
- May 24, 2020
- Messages
- 3,529
- Points
- 523
Reputation:
- By BattleKing
i have to change "127.0.0.1" for my server IP or?