blockAccess Geolocation & VPN Control
Lightweight • Config-driven • PHP

Clean, consistent access control with a white + orange aesthetic

Enforce geolocation and VPN rules with a simple text config. Minimal setup, clear decisions, and a crisp, modern UI.

Uses ip-api.com • Optional caching • Graceful fallback on API issues
No build step required Text-based rules Works on shared hosting
access_control.php
Preview
<?php
include "access_control.php";
// Your protected PHP page...
?>
IP-API Integration
VPN Detection
Geolocation
Simple Rules

How it works

A clear flow: detect, query, apply rules, respond.

IP Detection

Identify IP via $_SERVER['REMOTE_ADDR'], with proxy fallback

API Query

Request details from ip-api.com—country, ISO code, and VPN signal.

Access Logic

Define allow, block, and only in access.txt. The only rule overrides others.

Graceful Fallback

On API error, allow access by default to prevent accidental blocks.

Features

Polished essentials for practical control.

Setup

From download to enforcement in minutes.

  1. 1. Download

    Clone or download the blockAccess repo to your server.

  2. 2. Placement

    Place access_control.php in your web directory.

  3. 3. Configuration

    Create access.txt with your rules.

  4. 4. Integration

    <?php include "access_control.php"; ?>
  5. 5. Permissions

    Allow outbound HTTP to http://ip-api.com.

Example access.txt

# This file contains access rules for the website:
# - 'allow' specifies countries that are explicitly allowed to access the site.
# - 'block' specifies countries that are explicitly denied access to the site.
# - 'only' specifies countries that are granted special access, overriding other restrictions.

allow_vpn:false   # You can set your own value to disable vpn detection
allow:USA         # Visitors from the USA are explicitly allowed.
allow:Canada      # Visitors from Canada are explicitly allowed.
block:India       # Visitors from India are explicitly blocked.
block:Israel      # Visitors from Israel are explicitly blocked.
only:Malaysia     # Visitors from Malaysia are treated as Main Users, granted access regardless of other rules.

Customization

Tune rules and VPN policy to suit your needs.

Access Rules

Modify access.txt to add, remove, or update country rules. Keep control simple and explicit.

VPN Policy

Adjust the if ($isVpn) logic in access_control.php to allow, block, or handle VPNs differently.

Important Notes

Best practices for reliability and compliance.