[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Beginner PHP Tutorial – 65 – Getting Visitors IP Address
by
Tags:
Comments
24 responses to “Beginner PHP Tutorial – 65 – Getting Visitors IP Address”
-
Change cpanel ip adress random ly ?
-
1:41 – Windows Shutting Down
-
I recommend you proxydocker, i use it for a long period and it's really great.
http://bit.ly/2B09Fho -
we could use in_array function much easier 🙂
-
great job but one issue that I am facing is there away you can tell me how I can put into my MySQL to get visitors IP addresses when they come on my site that would be really helpful other wise this way would be kinda useless I like this because I can ban them in 3 different ways which I consider more protected anyways any help would do thank you
-
thx, great vid
-
Thank you for the tutorial. You can also use for loop
<?php
$ip_address = $_SERVER['REMOTE_ADDR'];
$ip_block = array('127.0.0.1','100.232.11.444');
$count = count($ip_block) -1;for($x=0;$x<=$count;$x++) {
if($ip_address == $ip_block[$x]) {
die('Your IP '.$ip_address.' has been blocked');
}
}?>
<h1>Welcome</h1>
-
For those who are getting ::1, just use 127.0.0.1 instead of localhost in your URL.
-
you can also use this as an replacement of an .htaccess file by dooing as followed
<?php
$ip = $_SERVER['REMOTE_ADDR'];
if ($ip == "127.0.0.1")
{
echo "Display what you want to display"
}
else
{
echo "You do not have any premissions to view this information"
}
?>
hope this helped some of you out 🙂 -
u simply don't use arrays for things like that bro , u use database , so it's a bit complicated than that … , u need to access database , get the blocked IPs , then u can compare the given IP to the blocked IPs from database , then there u go
-
Question. I have a couple websites hosted by Blue Host – the CMS is wordpress. I do want to block a few IIP addresses – does anyone know where I should put it on my sites? Would it be Appearences – – >Editor? I know – pretty stupid question.
-
Switch the address in the address bar from localhost/dir/file.php to 127.0.0.1/dir/file.php
-
my ip address is ::1?
-
For those who have their IP address as ::1 use this as $ip_blocked = array('::1','100.100.100.100');
-
Hi Alex 🙂
Thank you Alex -
::1 is IPv6 address equal to 127.0.01 as in IPv4
-
trust me he does
-
Why, if there is a better way, do you tell us this way to get an IP adres?
-
I think not everyone watches every single video, made by Alex..
-
Oh god! The ::1 has returned to haunt me D:
-
These videos aren't meant to be seen as a series. While they can be seen in order, they are meant for reference. So yeah, he does need to say that at the beginning of every video.
And even if he didn't have to, it's his video so it's his choice. So don't try to teach him what to do, just watch the video say thanks and GTFO.
-
100.0.0.0.0.0.0.0.0.0.0.0.0.1
-
NOOB search on the google
-
in IPV6 (internet protocol version 6), ::1 is the same as 127.0.0.1
Leave a Reply