Beginner PHP Tutorial – 65 – Getting Visitors IP Address

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

24 responses to “Beginner PHP Tutorial – 65 – Getting Visitors IP Address”

  1. HIMEL SARKAR Avatar

    Change cpanel ip adress random ly ?

  2. Xenon Avatar

    1:41 – Windows Shutting Down

  3. Emilia Clarke Avatar

    I recommend you proxydocker, i use it for a long period and it's really great.
    http://bit.ly/2B09Fho

  4. DrHanna Avatar

    we could use in_array function much easier 🙂

  5. BlueDragon9005 Avatar

    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

  6. Ronnie Javien Jr. Avatar

    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>

  7. Gaurav Kumar Avatar

    For those who are getting ::1, just use 127.0.0.1 instead of localhost in your URL.

  8. jamietjeh Avatar

    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 🙂

  9. Senshi Codo Avatar

    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

  10. bigfuzzydog Avatar

    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.

  11. Moby - Avatar

    Switch the address in the address bar from localhost/dir/file.php to 127.0.0.1/dir/file.php

  12. john mart belamide Avatar

    my ip address is ::1?

  13. Rijin Mk Avatar

    For those who have their IP address as ::1 use this as $ip_blocked = array('::1','100.100.100.100');

  14. xxiRaQiAtheistxx Avatar

    Hi Alex 🙂
    Thank you Alex

  15. BaliLandandVilla Avatar

    ::1 is IPv6 address equal to 127.0.01 as in IPv4

  16. Joost B Avatar

    Why, if there is a better way, do you tell us this way to get an IP adres?

  17. SuperNerdPride Avatar

    I think not everyone watches every single video, made by Alex..

  18. xXxBladeStormxXx Avatar

    Oh god! The ::1 has returned to haunt me D:

  19. xXxBladeStormxXx Avatar

    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.

  20. Rahil Wazir Avatar

    100.0.0.0.0.0.0.0.0.0.0.0.0.1

  21. Rahil Wazir Avatar

    NOOB search on the google

  22. Joross Barredo Avatar

    in IPV6 (internet protocol version 6), ::1 is the same as 127.0.0.1

Leave a Reply

Your email address will not be published. Required fields are marked *