xF2 Add-on Please Help me!

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
25,928
Points
823

Reputation:

xauUUL

I got less but I got best!
Collaborate
Registered
Joined
Jun 22, 2021
Messages
118
Points
43

Reputation:

Deleted

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:

Yes!

We would like to see an update on that addon.

https://enxf.net/resources/proxy-check.2520/

Where we can specific usergroup to bypass.

Such as: Administrator, Mods: Cant be detected.

Registered Members : Can detected VPN using or not.
xauUULThere is a permission setting which you can set for the specific groups:

1626106193000.png


So disable this for the admin group and for the moderators.
 
View previous replies…

xauUUL

I got less but I got best!
Collaborate
Registered
Joined
Jun 22, 2021
Messages
118
Points
43

Reputation:

solved
 
Last edited:

xauUUL

I got less but I got best!
Collaborate
Registered
Joined
Jun 22, 2021
Messages
118
Points
43

Reputation:

solved
 
Last edited:

xauUUL

I got less but I got best!
Collaborate
Registered
Joined
Jun 22, 2021
Messages
118
Points
43

Reputation:

solved
 
Last edited:

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:

@ENXF NET addon is not working right.
xauUULwhy should the addon not work, uninstall the addon, and reupload the files and install it again, do not make any changes on the code. Test first the stuff via permissions, this should have to work. Currently I do not have any API key's to test it.
 

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:

as you can see here comment from @ENXF NET

Addon is not working properly. this addon also used by enxf.net and it works but when i test it on my side, its keep saying i have vpn on which is not.
xauUULI will have a look into this addon again as well, it seems to be a different one. I mixed it with the other request you sent me, sorry
 

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:

I will have a look into this addon again as well, it seems to be a different one. I mixed it with the other request you sent me, sorry
BattleKingHere are two addons mixed
  1. https://enxf.net/resources/proxy-check.2520
  2. https://enxf.net/resources/j-ipcheck-vpn-proxy-block.2544/
and the answer from @enxf.net refers to the second one.

For my understanding the first one missed possibly the IPv6 check, which is the reason that you got the message: "Proxy, VPN or Data center IP are not allowed here". To solve that please correct in Listener.php the following function with the shown content below:

PHP:
    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;
    }
 

xauUUL

I got less but I got best!
Collaborate
Registered
Joined
Jun 22, 2021
Messages
118
Points
43

Reputation:

solved
 
Last edited:

xauUUL

I got less but I got best!
Collaborate
Registered
Joined
Jun 22, 2021
Messages
118
Points
43

Reputation:

solved
 
Last edited:

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:

still same error, im not using vpn but still saying : "Proxy, VPN or Data center IP are not allowed here"

i made changes as you said. in Listener.php
xauUULok lets do some debug statements. Change the echo line to
Code:
echo "($result):Proxy, VPN or Data center IP ($ip) are not allowed here";

What is the result then?

Then we can disable the check for admins and moderators, like that, also check 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;
    }
}
 
Last edited:

xauUUL

I got less but I got best!
Collaborate
Registered
Joined
Jun 22, 2021
Messages
118
Points
43

Reputation:

solved
 
Last edited:
Top