Results 1 to 3 of 3

Thread: ip redirect

  1. #1
    Join Date
    Dec 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ip redirect

    When user comes to website it stores there ip address. So next time they visit
    the site it redirects them a different page.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    You need server side coding to do this do you have php, asp, other?
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    PHP
    PHP Code:
    <?php
    function find($file$ip){
        
    $test strrpos($file$ip);
        
    $exception = array('0');
        if(
    $test !== false && !in_array($ip$exception)){
            
    header("Location: redirect.php");
        } else if (!
    in_array($ip$exception)){
            
    file_put_contents('getout.txt'$_SERVER['REMOTE_ADDR']."\n"FILE_APPEND);
        }
    }
    find(file_get_contents('getout.txt'), $_SERVER['REMOTE_ADDR']);
    ?>
    Make a file called getout.txt. If you do not want some ips to always redirect when viewing the page (for example, you), insert it into the $exception array.
    Last edited by Nile; 12-28-2010 at 01:15 AM.
    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •