Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7745273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:58:20+00:00 2026-06-01T09:58:20+00:00

So I want to check if the user is in specific county $ip =

  • 0

So I want to check if the user is in specific county

    $ip = user ip;
$countryIP = some number;

    if($ip == $countryIP){echo 'okey';} else {echo 'not okey';}

I dont want to use database with geo location since I need it for only one country.Also i dont want to use third party services.

For example abc.go.com/watch is only for US and I want to do something similar to that

Thanks 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:58:22+00:00Added an answer on June 1, 2026 at 9:58 am

    Ok, provided you’re happy with checking Bulgaria against the block you indicated, then you can do it reasonably simply – all you need to do is convert the ip addresses to the numerical notation.

    77.85.0.0/16 means any code from 77.85.0.0 to 77.85.255.255 – now convert these to a numerical values:

    77*256^3+85*256^2+0*256+0 = 1297416192
    77*256^3+85*256^2+255*256+255 = 1297481727
    

    Now convert the IP you want to check in the same manner – and verify that it’s between these two numbers. Of course, it’s not as simple as you are saying. There are over 400 different blocks for Bulgaria. If you care about it all, here’s the full list of their numerical representation (as of the last update). Check yourself, for example, here: http://www.countryipblocks.net/country-blocks/select-formats/

    # Country: BULGARIA
    # ISO Code: BG
    # Total Networks: 497
    # Total Subnets:  4,148,224
    31.13.192.0/18
    31.41.16.0/21
    31.211.128.0/19
    37.60.136.0/21
    37.63.0.0/17
    37.130.240.0/21
    37.157.136.0/21
    37.157.160.0/19
    46.10.0.0/16
    46.16.192.0/21
    46.35.160.0/19
    46.40.64.0/18
    46.47.64.0/18
    46.55.128.0/17
    46.229.192.0/20
    46.232.152.0/21
    46.233.0.0/18
    46.237.64.0/18
    46.238.0.0/18
    46.249.64.0/19
    46.252.48.0/20
    46.253.0.0/20
    46.254.128.0/21
    62.44.96.0/19
    62.73.64.0/18
    62.176.64.0/19
    62.176.96.0/19
    62.182.112.0/21
    62.204.128.0/19
    62.213.160.0/19
    62.221.128.0/19
    77.70.0.0/17
    77.71.0.0/17
    77.76.0.0/18
    77.76.128.0/18
    77.77.0.0/18
    77.77.128.0/18
    77.78.0.0/18
    77.78.128.0/18
    77.85.0.0/16
    77.95.232.0/21
    77.236.160.0/19
    77.238.64.0/19
    77.246.208.0/20
    78.40.136.0/21
    78.83.0.0/16
    78.90.0.0/16
    78.108.240.0/20
    78.128.0.0/17
    78.130.128.0/17
    78.142.0.0/18
    78.154.0.0/19
    78.159.128.0/19
    79.100.0.0/16
    79.110.112.0/20
    79.124.0.0/18
    79.124.64.0/19
    79.132.0.0/19
    79.134.32.0/19
    79.134.160.0/19
    80.72.64.0/20
    80.72.80.0/20
    80.78.224.0/20
    80.80.128.0/20
    80.80.144.0/20
    80.95.16.0/20
    80.253.48.0/20
    81.161.240.0/20
    82.101.64.0/18
    82.103.64.0/18
    82.118.224.0/19
    82.119.64.0/19
    82.137.64.0/18
    82.146.0.0/19
    82.147.128.0/19
    82.199.192.0/19
    83.97.24.0/21
    83.97.64.0/21
    83.142.16.0/21
    83.143.144.0/21
    83.143.176.0/21
    83.143.248.0/21
    83.148.64.0/18
    83.222.160.0/19
    83.228.0.0/17
    84.21.192.0/19
    84.22.0.0/19
    84.38.240.0/20
    84.40.64.0/18
    84.43.128.0/17
    84.54.128.0/18
    84.201.192.0/20
    84.238.128.0/17
    84.242.128.0/18
    84.252.0.0/18
    85.11.128.0/18
    85.14.0.0/18
    85.91.128.0/19
    85.95.64.0/19
    85.118.64.0/19
    85.118.192.0/21
    85.130.0.0/17
    85.187.0.0/16
    85.196.128.0/18
    85.217.128.0/17
    85.239.128.0/19
    85.255.128.0/20
    85.255.160.0/20
    87.97.128.0/17
    87.116.64.0/18
    87.118.128.0/18
    87.119.64.0/18
    87.120.0.0/16
    87.121.0.0/16
    87.126.0.0/16
    87.227.128.0/17
    87.239.152.0/21
    87.246.0.0/18
    87.247.248.0/21
    87.252.160.0/19
    87.254.160.0/19
    88.80.96.0/19
    88.80.128.0/19
    88.87.0.0/19
    88.203.128.0/17
    88.213.192.0/18
    89.25.0.0/17
    89.106.96.0/19
    89.186.192.0/19
    89.190.192.0/19
    89.215.0.0/16
    89.252.192.0/18
    89.253.128.0/18
    90.154.128.0/17
    91.92.0.0/16
    91.134.0.0/16
    91.139.128.0/17
    91.148.128.0/18
    91.191.208.0/20
    91.192.236.0/22
    91.193.156.0/22
    91.193.200.0/22
    91.195.24.0/23
    91.196.64.0/22
    91.196.124.0/22
    91.196.224.0/22
    91.198.119.0/24
    91.198.132.0/24
    91.198.181.0/24
    91.198.228.0/24
    91.199.36.0/24
    91.199.128.0/24
    91.199.150.0/24
    91.199.237.0/24
    91.199.247.0/24
    91.201.172.0/22
    91.204.156.0/22
    91.206.20.0/23
    91.206.138.0/23
    91.207.190.0/23
    91.209.8.0/24
    91.209.21.0/24
    91.209.146.0/24
    91.210.88.0/22
    91.211.108.0/22
    91.211.188.0/22
    91.211.232.0/22
    91.212.13.0/24
    91.212.17.0/24
    91.212.37.0/24
    91.212.163.0/24
    91.212.201.0/24
    91.212.233.0/24
    91.212.235.0/24
    91.213.12.0/24
    91.215.216.0/22
    91.216.71.0/24
    91.216.95.0/24
    91.216.174.0/24
    91.216.253.0/24
    91.217.148.0/24
    91.217.205.0/24
    91.217.215.0/24
    91.218.80.0/22
    91.220.176.0/24
    91.220.189.0/24
    91.221.254.0/23
    91.222.20.0/22
    91.223.66.0/24
    91.226.226.0/23
    91.228.38.0/24
    91.230.6.0/23
    91.230.192.0/22
    91.230.230.0/24
    91.230.231.0/24
    91.232.209.0/24
    91.233.32.0/24
    91.234.19.0/24
    91.234.21.0/24
    91.234.92.0/22
    91.235.164.0/24
    91.235.248.0/22
    91.236.144.0/22
    91.237.56.0/22
    91.237.102.0/23
    92.62.240.0/20
    92.247.0.0/16
    93.93.8.0/21
    93.94.136.0/21
    93.123.0.0/17
    93.152.128.0/17
    93.155.128.0/17
    93.183.128.0/18
    94.26.0.0/17
    94.72.128.0/18
    94.73.0.0/18
    94.101.192.0/20
    94.139.192.0/19
    94.155.0.0/16
    94.156.0.0/16
    94.190.128.0/17
    94.236.128.0/17
    95.42.0.0/16
    95.43.0.0/16
    95.87.0.0/18
    95.87.192.0/18
    95.111.0.0/17
    95.140.208.0/20
    95.158.128.0/18
    95.168.224.0/19
    95.169.192.0/19
    109.104.192.0/19
    109.107.64.0/19
    109.120.192.0/18
    109.121.128.0/18
    109.121.192.0/18
    109.160.0.0/17
    109.199.128.0/19
    109.199.224.0/19
    128.140.176.0/20
    130.185.192.0/18
    130.204.0.0/16
    145.255.192.0/19
    149.62.192.0/18
    158.58.192.0/18
    164.138.216.0/21
    176.12.0.0/18
    176.67.232.0/21
    176.222.0.0/20
    178.16.128.0/20
    178.75.192.0/18
    178.132.80.0/21
    178.169.128.0/17
    178.239.112.0/20
    178.239.224.0/20
    178.249.168.0/21
    178.254.192.0/18
    188.124.64.0/19
    188.126.0.0/19
    188.127.64.0/19
    188.254.128.0/17
    192.58.32.0/22
    192.92.129.0/24
    192.162.231.0/24
    193.9.16.0/24
    193.16.102.0/24
    193.16.157.0/24
    193.16.246.0/24
    193.17.229.0/24
    193.19.172.0/22
    193.22.103.0/24
    193.22.248.0/24
    193.23.52.0/24
    193.24.240.0/22
    193.25.162.0/23
    193.26.14.0/24
    193.26.216.0/24
    193.28.250.0/24
    193.29.55.0/24
    193.30.228.0/22
    193.36.35.0/24
    193.37.238.0/24
    193.41.64.0/22
    193.41.182.0/23
    193.41.188.0/22
    193.43.26.0/24
    193.47.74.0/24
    193.68.0.0/19
    193.68.96.0/19
    193.68.128.0/17
    193.84.86.0/24
    193.93.24.0/22
    193.104.79.0/24
    193.104.165.0/24
    193.105.60.0/24
    193.105.148.0/24
    193.105.151.0/24
    193.105.196.0/24
    193.107.36.0/22
    193.107.68.0/22
    193.108.24.0/24
    193.108.32.0/23
    193.109.54.0/23
    193.110.82.0/24
    193.110.132.0/24
    193.110.159.0/24
    193.110.216.0/21
    193.111.89.0/24
    193.111.194.0/23
    193.138.67.0/24
    193.142.0.0/24
    193.150.67.0/24
    193.151.20.0/22
    193.151.80.0/22
    193.160.159.0/24
    193.161.192.0/24
    193.164.222.0/23
    193.169.198.0/23
    193.178.152.0/23
    193.178.166.0/24
    193.178.222.0/24
    193.186.38.0/24
    193.192.48.0/23
    193.192.56.0/23
    193.193.162.0/23
    193.193.164.0/24
    193.193.182.0/24
    193.194.140.0/23
    193.194.156.0/24
    193.200.1.0/24
    193.200.2.0/24
    193.200.8.0/24
    193.200.12.0/24
    193.200.14.0/23
    193.200.16.0/23
    193.200.24.0/24
    193.200.28.0/24
    193.201.114.0/23
    193.201.172.0/24
    193.201.240.0/22
    193.202.108.0/24
    193.203.198.0/23
    193.218.0.0/24
    193.228.152.0/24
    193.254.29.0/24
    194.0.32.0/24
    194.0.235.0/24
    194.8.4.0/24
    194.8.53.0/24
    194.8.60.0/24
    194.9.6.0/23
    194.12.224.0/19
    194.34.12.0/24
    194.36.167.0/24
    194.48.206.0/24
    194.50.73.0/24
    194.50.76.0/24
    194.50.122.0/24
    194.54.140.0/22
    194.63.136.0/22
    194.79.12.0/22
    194.88.228.0/23
    194.88.250.0/23
    194.110.205.0/24
    194.141.0.0/19
    194.141.32.0/19
    194.141.64.0/18
    194.141.128.0/17
    194.145.63.0/24
    194.145.160.0/22
    194.146.232.0/22
    194.150.116.0/22
    194.150.180.0/23
    194.153.118.0/24
    194.153.145.0/24
    194.169.231.0/24
    194.187.132.0/22
    194.246.110.0/23
    195.8.222.0/23
    195.10.193.0/24
    195.20.20.0/22
    195.20.24.0/22
    195.22.146.0/23
    195.24.32.0/19
    195.24.88.0/21
    195.28.6.0/23
    195.34.96.0/19
    195.35.84.0/24
    195.39.198.0/23
    195.39.212.0/23
    195.42.142.0/23
    195.47.193.0/24
    195.54.44.0/23
    195.62.22.0/23
    195.64.160.0/23
    195.66.125.0/24
    195.68.200.0/23
    195.68.214.0/23
    195.69.108.0/22
    195.69.120.0/22
    195.69.164.0/22
    195.72.112.0/24
    195.74.85.0/24
    195.85.215.0/24
    195.88.74.0/23
    195.88.140.0/23
    195.96.224.0/19
    195.110.24.0/23
    195.114.112.0/23
    195.128.132.0/24
    195.128.134.0/24
    195.128.224.0/23
    195.137.252.0/23
    195.138.128.0/19
    195.149.71.0/24
    195.149.248.0/21
    195.162.72.0/23
    195.170.166.0/24
    195.170.178.0/24
    195.177.218.0/23
    195.177.248.0/23
    195.178.8.0/23
    195.178.98.0/23
    195.178.116.0/23
    195.182.41.0/24
    195.182.44.0/24
    195.189.80.0/22
    195.189.224.0/23
    195.191.34.0/23
    195.191.60.0/23
    195.191.94.0/23
    195.191.148.0/23
    195.214.248.0/21
    195.216.228.0/24
    195.225.51.0/24
    195.225.124.0/22
    195.225.252.0/22
    195.230.0.0/19
    195.234.84.0/22
    195.234.236.0/22
    195.238.84.0/23
    195.242.106.0/23
    195.242.126.0/23
    195.242.240.0/22
    195.246.240.0/23
    212.5.32.0/19
    212.5.128.0/19
    212.21.128.0/19
    212.25.32.0/19
    212.36.0.0/19
    212.39.64.0/19
    212.43.32.0/19
    212.45.64.0/19
    212.50.0.0/19
    212.50.64.0/19
    212.56.0.0/19
    212.70.128.0/19
    212.72.192.0/19
    212.73.128.0/19
    212.75.0.0/19
    212.91.160.0/19
    212.95.160.0/19
    212.104.96.0/19
    212.116.128.0/19
    212.117.32.0/19
    212.122.160.0/19
    212.124.64.0/19
    212.233.128.0/17
    213.16.32.0/19
    213.91.128.0/17
    213.108.240.0/21
    213.130.64.0/19
    213.137.32.0/19
    213.145.96.0/19
    213.149.128.0/19
    213.167.0.0/19
    213.169.32.0/19
    213.191.192.0/19
    213.214.64.0/19
    213.222.32.0/19
    213.226.0.0/19
    213.226.32.0/19
    213.231.128.0/18
    213.240.192.0/18
    217.9.224.0/20
    217.10.240.0/20
    217.18.240.0/20
    217.30.208.0/20
    217.75.128.0/20
    217.75.144.0/20
    217.79.32.0/20
    217.79.64.0/20
    217.79.80.0/20
    217.145.80.0/20
    217.145.160.0/20
    217.174.48.0/20
    217.174.144.0/20
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to check if user input a positive integer number. 1 = true
i want code to check whether the user in logged in or not. I
I want to be able to check for specific conditions when a user selects
I want to check for user inactivity in my application. I did a little
I made a login button and want to check if the user logged in
I want to check in my application programmatically if user shutdown/restart/logoff the computer. I
I want to check to see if a user has rated my app on
I want to check whether the loggedIn user has liked a specified page or
Basically I want to check the extended permissions the user has granted my app.
I want to check the strength of the password entered by user during registration.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.