Hello,

I have a few free dating sites and want block dating spammers who register on my websites.

I have been using htaccess to block a lots of IP addresses from my free dating sites. However, they still come back to register their profiles at my sites.

Is there a better way to block a specific country from my dating site?

Thanks.

Dani AI

Generated

A practical, low-maintenance approach is to stop blocking dozens of IPs in .htaccess and instead combine country-level geolocation (applied only to the registration flow) with anti-abuse checks at the application edge. ’s manual htaccess blocks work but are brittle and hard to keep current. ’s suggestion to use geolocation is the same direction but should be paired with proxy/VPN detection (as noted), rate limits, and simple verification steps so legitimate visitors are not lost.

A small, proven workflow: 1) block registrations from the unwanted country at the edge (CDN/WAF) or in the app, not the whole site; 2) detect and block known proxy/VPN IPs; 3) add challenge/verification for suspicious signups (email, SMS, CAPTCHA, honeypot); 4) throttle and log attempts for review. Example application-level check (PHP + GeoIP DB):

<?php
use GeoIp2\Database\Reader;

$ip = $_SERVER['REMOTE_ADDR']; // or trusted forward header when behind a proxy/CDN
$reader = new Reader('/path/to/GeoIP2-Country.mmdb');

try {
  $country = $reader->country($ip)->country->isoCode; // e.g. "CN"
} catch (Exception $e) {
  $country = null;
}

$blocked = ['CN','RU']; // adjust list
if ($country && in_array($country, $blocked)) {
  header('HTTP/1.1 403 Forbidden');
  echo 'Registration from this country is currently closed.';
  exit;
}

Do not rely on geolocation alone. Add proxy/VPN checks, block disposable-email domains, require phone verification for suspicious profiles, and consider manual approval for first profiles. If using WordPress (as suggested), pick a plugin that integrates GeoIP plus proxy detection.

Operational tips: update the GeoIP database regularly, log blocked attempts for false positives, whitelist known search bots and partners, and test blocks with VPNs from the target country. For dating sites, verification and behavioral signals usually cut spam far more effectively than broad country bans.

Recommended Answers

All 9 Replies

Try doing a Google search for a list of IP blocks from a specific country. For example, here is a list but it is rather old (May 2009):

The other way you can do it is with geolocation software. You can use IP geolocation to determine the country the user is located in, and if they are in a country you don't want, give them a friendly message saying that registration is currently closed to them, but they can still browse the site.

An example of geolocation software is www.quova.com

There's also GeoLite which offers a free version, if I remember correctly:

Create and upload an .htaccess file and paste the code:
order deny,allow
deny from
(IP you want to deny, you can use the first numbers of the IP for a complete country)

nomajulu,

That's what he's doing already, but he's doing it for a lot of different IPs manually. He's wondering if there is a better way.

I believe most of the spammer will use the proxy to spam the stuff, therefore i may suggest you to use the proxy detector to block them out from reaching your page. Check this out: http://www.ip2proxy.com

There is a way to determine the origin country of an IP but when I last checked on it it was very complicated. By now there should be APIs out to tell you the origin country. The reason I'm saying to go with country is because usually that's what your problem is. It's usually girls wanting to get hooked up on mail order bride stuff. Get married and get into the US.

nomajulu,

That's what he's doing already, but he's doing it for a lot of different IPs manually. He's wondering if there is a better way.

Blocking only the specific IP blocks from that country is simple and smart. And there are not that many IP blocks per one country.

Anyway, if you are using wordpress, you might as well search for some IP blocking plugins, as I know there are some that can help you.

You can do that simply by blocking your site servcies in that country IP . This is not a big task which is worring about.

I found this solution, refer to this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.