I am trying to block my website's access by a particular router, but that router has a dynamic IP. It changes the IP dynamically, so even after blocking one IP of the router it can still access the website after it has changed its IP. How do I block that specific router from accessing my website?
You could block an IP range (if you see within which range the router gets its IP addresses)
120.120.0.0 - 120.120.255.255
Related
How to check if user is visiting site from our own local network or common internet.
Suppose, If somebody scans the qr code in our restaurant, it links to something, which is checking, are you connected to the local network or you're opening it from global? (no idea how)
Local - redirecting to the local domain (no idea how i can do this also, eg. restaurant.menu)
Global - redirecting to the global domain (eg. menu.com)
You can check the IP of the customer and compare it with IP range of your network. If the customer IP falls in your range redirect the user to local site otherwise to your global site.
You can use $_SERVER['REMOTE_ADDR']; to get IP of user visiting the site from the QR code.
You can setup a dns record for your local IP (external IP). The IPs mentioned in the comment 10.100.109.10-256 are private IPs and not publicly accessible. These wont work, search on google with what is my ip and I am sure you will get many options.
Once done you can create a script which will get user ip address ($_SERVER['REMOTE_ADDR'];) and do a gethostbyaddr() lookup to get the hostname associated with that IP. If the hostname matches the one you have set, your visitor is from a local connection.
For the redirection to work, if your website is hosted on server that is not in the same network as your router then you need to have a public facing domain name (ie. restaurant.menu should be reachable publicly)
A second approach could be to redirect the traffic at the router level. If your router allows you can setup a redirection in the router itself. If it does not you will need to setup a dns server. In this dns server you will specify the desired (local) IP address for the domain. You router needs to have a backup dns to keep resolving other domains.
These are hacks but if implemented correctly they will provide very predictable results.
I am working on a WordPress website and have the plugin WP Security installed. It tells me the current IP Address I am on when viewing the website. However the IP address it is producing isn't my correct IP address. I did the same thing on another WordPress website and it did produce the correct IP address.
The reason I'm trying to figure out the IP address is because someone entered their login credentials wrong 5 times. The website is set up so when that happens it locks that person out of website for an hour. Well when this happened it didn't just block their IP address, but blocked our IP address and the clients IP address. And the IP address it said it was blocking was neither of ours.
What could be the reasoning for this single website to be grabbing the incorrect IP address and believing it belongs to us and our client?
EDIT: after looking into it a little more the IP address that is showing up on this website is through Liquid Web, our hosting provider. So it is showing that IP address instead of our current/local IP address.
"All" traffic is routed to your webserver via another server (CDN, Firewall, Nginx etc). Following a failed login attempt the WP plugin is blacklisting this intermediate servers IP address locking everyone out.
Typically php scripts gets the visitors IP frome the REMOTE_ADDR environment variable: but depending on configuration with e.g. intermediate Nginx server REMOTE_ADDR may contain the nginx server IP; and the "real visitor" IP may be in HTTP_X_REAL_IP
You can use this script to: check which environment variable on your site contains the actual visitor IP.
It would be useful if you provided the link to the site from which you got the WP Security plugin.
Solution:
Ask your host provider to configure servers so REMOTE_ADDR on your web server will contain visitors IP; or
If you know which environment var is valid (above); then the security plugin may have a setting to configure accordingly; or
Report as a bug on plugins support forum.
I have problems accessing pages on xml without domain (access ip address directly)
this is my ip address : http://107.170.117.8/
this is xml page that i want to access : http://107.170.117.8/xml-reference/index.xml
i want to access directly xml without domain, but it seems can't.
So, is there anyway i can access xml page without domain?
If you can access a site via a domain name, but not an ip address, there may be a few reasons:
you might have the wrong ip address. It's common for a webserver to have multiple ip addresses.
the server might be configured to be using name based virtual hosts. This is probably the issue.
less commonly, the server might be using ipv6
The answer is within your question: use the domain.
I create website using php. and then I want to block VPN IP ADDRESS or hide ip Program. in my login.
I see ebay.com website can block VPN IP ADDRESS or hide ip Program.
How do write script php for block VPN IP ADDRESS or hide ip Program.
It's simple to implement:
if (in_array($_SERVER['REMOTE_ADDR'], $blocked_ips)) die("Go away!");
... but it requires a list of IPs you'd like to block. IP hiding works by using a proxy. There is no way to detect if a user is hiding their IP besides checking if traffic is coming from a known IP hiding service's IP. Where you might find such a list, I don't know, but that's the only way to go about this.
I am wondering about a certain server setup.
Lets say I have a web server running on my local network, which is accessible using an url such as www.example.com from within and also outside the network.
I would like my PHP website to be able to determine if a request comes from within the internal LAN or from the outside. I doubt that this will be possible using the IP address as the request will look as if it is coming from a public IP address, and not the internal one 192.168.x.x. Also the public IP might change from time to time.
Would this be possible, and how could i achieve this in PHP?
If your requests comes from inside the lan then the $_SERVER['REMOTE_ADDR'] will be from a private ip address group, if if comes from outside the lan it will not.
Unless you have a poorly configured internal network, but this will probably not be the case.
look here for the correct address groups
http://en.wikipedia.org/wiki/Private_network
If your internal dns server resolves example.com to the public ip then the requests will appear to come from the public ip as well, so if this is the case you also know that the request came from inside.
As long as you know what the external NAT IP range is for your office, you should be able to do this easily be accessing the $_SERVER['REMOTE_ADDR'] value.