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 5 of 5
  1. #1
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Substitution for .htaccess password

    dns.inc.php:
    PHP Code:
    <?php
    if (!stristr$_SERVER['HTTP_HOST'], 'server2')) { 
        
    header('Location: http://games.game-host.org/css'); 
    }  
    ?>
    where server2 is the computers name and http://games.game-host.org/css is the address to go to if the domain is not correct.
    ------------------------------------
    This will only work if the client and the server are on the same network.

    Purpose:
    I did this because I needed a way to have an admin panel just for me. This also takes all passwords out of it. No passwords and no usernames.

    How?
    server2 has to be a network only dns(computer name). Then have it redirect to anything you want if its not correct.
    Just include that dns.inc.php page on every page ytou want protected.

    Working example:
    http://games.game-host.org/css/maps_admin/
    will redirect you to:
    http://games.game-host.org/css/
    But
    http://server2/css/maps_admin/
    will be the page with no change. You will not even know it is there.
    http://server2/css/maps_admin
    Why not thank me?

    http://adamsworld.name

  • #2
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    I am afraid it might fail.
    Attached Thumbnails Attached Thumbnails Substitution for .htaccess password-maps_admin.png  
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

  • #3
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts
    weird... its worked great so far
    Why not thank me?

    http://adamsworld.name

  • #4
    New Coder
    Join Date
    Sep 2005
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you cannot trust any $_SERVER variable that begins with HTTP (e.g., $_SERVER["HTTP_REFERER"], $_SERVER['HTTP_HOST'])

    See for example http://shiflett.org/archive/98

  • #5
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts
    OK, well I wont use that anymore.
    I am more or less a php newbie... BUt im getting better.



    ILLINI
    Why not thank me?

    http://adamsworld.name


  •  

    Posting Permissions

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