Page 1 of 7 123 ... LastLast
Results 1 to 10 of 61

Thread: Redirection tool using computer IP...

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

    Default Redirection tool using computer IP...

    could someone please make me a script that only allows certain IP address to view a folder?

    eg: if the computer ip address was 11.111.11 they could view the pages in a folder and if the ip address wasn't 11.111.11 they got redirected to the main website page?

    thanks :-)

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Are talking about in a local network or public domain? If you were talking about public, take a look around the forums. I believe there are some scripts like that (you may need to edit it to suit your needs) floating around somewhere. As for a local network (unless you automatically assign the computers on your network) it would be a mess. I guess you need more specifics in that, but as I said before, just take a look around the forums for something to do with remote address (IP Address).

    EDIT: I noticed that this is in the Javascript forum. I don't know how you would do it with javascript but I'm sure someone else here does. If not, this can be easily accomplished using server-side languages (PHP, ASP, etc).

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Not in Javascript, no. You'd need some server-side language.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Dec 2006
    Posts
    74
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    drat - ok i found this post by blizzard. How would one go about changing it to only allow certain ip addresses?

    http://www.dynamicdrive.com/forums/s...21&postcount=6

  5. #5
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Saw you posted before I finished typing mine out.

    Change the following in red:

    Code:
    ErrorDocument 403 /banned.html
    order allow,deny
    allow from 192.22.33.44
    deny from all
    Hope this helps.

    Not sure how to add mulitple IP Addresses (in .htaccess that is). Sure someone else does though.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Well... if your server is php enabled:
    Code:
    <script type="text/javascript">
    var ip = "<?php echo $_SERVER['ADDR']; ?>"
    if (ip == ip address here) {
        dosomething();
        }
    </script>
    pointless though, seeings you could do exactly the same thing with PHP and the user wouldn't be able to see it.

    /EDIT: Sorry test, we cross posted
    - Mike

  7. #7
    Join Date
    Dec 2006
    Posts
    74
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    thanks

    to ad more would i just have to add the
    ?allowed =
    line again?

  8. #8
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Lol... triple cross-posting. ^^
    - Mike

  9. #9
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Not a prob mike, posted a php script, then saw the OP posted an htaccess file and had to change the post.

    //EDIT: and again.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    to ad more would i just have to add the
    ?allowed =
    line again?
    Yes. Make sure your new lines are above the Deny line.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •