Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post

    links that only you can access

    I wonder if there is a way that there would be links which only you can access on your page?

    Does this work?

    PHP Code:
    $ip=$_SERVER['REMOTE_ADDR'];
    //echo $ip;
    if($_SERVER['REMOTE_ADDR']="your IP address"){
        include(
    "personallinks.php");

    When I tested on my other computer I don't think it worked.

  • #2
    Regular Coder student101's Avatar
    Join Date
    Nov 2007
    Posts
    634
    Thanks
    80
    Thanked 15 Times in 15 Posts
    Why not just have a login system and based on username accesslevel gets to see certain links?
    Code:
    username => text
    password => text
    accesslevel => int (1,2,3,4,5,etc...)
    Or try this:
    Code:
    //Assign the variable $ip which will be 127.0.0.1
    $ip=$_SERVER['REMOTE_ADDR'];
    //echo $ip;
    if($_SERVER['REMOTE_ADDR']=="127.0.0.1"){
    //include("personallinks.php");
    echo "I'm allowed 127.0.0.1, 'cause my IP is held inside your allowed database";
    }else{
    echo "I'm NOT allowed $ip";
    }
    Last edited by student101; 07-28-2008 at 08:44 AM.
    Thanks for your support!
    Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

    Give thanks & resolve when done :thumbsup:

  • #3
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by gilgalbiblewhee View Post
    I wonder if there is a way that there would be links which only you can access on your page?

    Does this work?

    PHP Code:
    $ip=$_SERVER['REMOTE_ADDR'];
    //echo $ip;
    if($_SERVER['REMOTE_ADDR']="your IP address"){
        include(
    "personallinks.php");

    When I tested on my other computer I don't think it worked.
    missing a '=', must be:

    PHP Code:
    $ip=$_SERVER['REMOTE_ADDR'];
    //echo $ip;
    if($_SERVER['REMOTE_ADDR']=="your IP address"){
        include(
    "personallinks.php");

    regards

  • #4
    Regular Coder BWiz's Avatar
    Join Date
    Mar 2006
    Location
    Sol System
    Posts
    471
    Thanks
    7
    Thanked 21 Times in 21 Posts
    It could also be the ip you trying to match.
    Also, if I remember correctly, having only one equal makes the if statment always true and always execute?
    BWiz :: Happy Coding!
    2006
    2007 2008 2009
    2010 2011
    Irrational numbers make no sense.

  • #5
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post
    Quote Originally Posted by student101 View Post
    Why not just have a login system and based on username accesslevel gets to see certain links?
    Code:
    username => text
    password => text
    accesslevel => int (1,2,3,4,5,etc...)
    Or try this:
    Code:
    //Assign the variable $ip which will be 127.0.0.1
    $ip=$_SERVER['REMOTE_ADDR'];
    //echo $ip;
    if($_SERVER['REMOTE_ADDR']=="127.0.0.1"){
    //include("personallinks.php");
    echo "I'm allowed 127.0.0.1, 'cause my IP is held inside your allowed database";
    }else{
    echo "I'm NOT allowed $ip";
    }
    does the IP differ from one computer to the next? Or is it by internet connection?
    Because both my computers seem to have the same IP!

  • #6
    Regular Coder BWiz's Avatar
    Join Date
    Mar 2006
    Location
    Sol System
    Posts
    471
    Thanks
    7
    Thanked 21 Times in 21 Posts
    If both of your computers are hooked up to the same internet connection, then the IP will be the same.
    BWiz :: Happy Coding!
    2006
    2007 2008 2009
    2010 2011
    Irrational numbers make no sense.

  • #7
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post
    Oh I didn't know that. Then it would be safe to use that script.

  • #8
    Regular Coder BWiz's Avatar
    Join Date
    Mar 2006
    Location
    Sol System
    Posts
    471
    Thanks
    7
    Thanked 21 Times in 21 Posts
    I would rely on a login based system, I think IPs can be faked - look at proxies.
    BWiz :: Happy Coding!
    2006
    2007 2008 2009
    2010 2011
    Irrational numbers make no sense.

  • #9
    Regular Coder
    Join Date
    Mar 2005
    Posts
    735
    Thanks
    4
    Thanked 1 Time in 1 Post
    Quote Originally Posted by BWiz View Post
    I would rely on a login based system, I think IPs can be faked - look at proxies.
    What do you mean by that?

  • #10
    Regular Coder BWiz's Avatar
    Join Date
    Mar 2006
    Location
    Sol System
    Posts
    471
    Thanks
    7
    Thanked 21 Times in 21 Posts
    In my opinion, a login based system would be more secure than something which relies soley on IP addresses. What happens if someone logs on to the web site from one of your computers, or somebody manages to gain access to your internet connection or system? I'm assuming that the links you are going to be posting are administrative links - what happens if you want to access them from somewhere other than your computer?
    Last edited by BWiz; 07-29-2008 at 10:02 AM.
    BWiz :: Happy Coding!
    2006
    2007 2008 2009
    2010 2011
    Irrational numbers make no sense.


  •  

    Posting Permissions

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