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 6 of 6
  1. #1
    Regular Coder ttttt's Avatar
    Join Date
    Oct 2005
    Posts
    372
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Password Protection

    Hi,
    I have an area of my site that I would like to password protect. I DO NOT want to use MySQL, but I would like to use flatfiles (preferably) or an xml file. However, the login does need to be a form, the username and password editable and the protection secure.
    I know I have very specific requirements, but could someone please help?
    Thanks,
    ttttt
    http://openoffice.org/- Microsoft Office without the Microsoft.
    [home page][forum]
    Versatile, free software

  • #2
    Regular Coder googleit's Avatar
    Join Date
    Jul 2006
    Location
    birmingham, uk
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts
    search on google there are loads of free ones

  • #3
    Regular Coder
    Join Date
    Aug 2006
    Location
    UK, London, Dartford
    Posts
    221
    Thanks
    3
    Thanked 14 Times in 14 Posts
    Not sure if you wanted one at the top of the page, well here's one!
    PHP Code:

    <?PHP
    $username 
    =  "test";
    $password =  "test";

    function 
    authenticate() {
      
    Header"WWW-authenticate: basic realm=\"Protected\"");
      
    Header"HTTP/1.0 401 Unauthorized");
      echo   
    "You must enter a valid login ID and password!";
      exit;
    }

    function 
    CheckPwd($user,$pass) {
      global 
    $username,$password;
      return (
    $user != $username || $pass != $password) ? false true;
    }

    if(!isset(
    $PHP_AUTH_USER)) {
      
    authenticate();
    }
    elseif(!
    CheckPwd($PHP_AUTH_USER,$PHP_AUTH_PW)) {
      
    authenticate();
    }
    ?>

  • #4
    Regular Coder ttttt's Avatar
    Join Date
    Oct 2005
    Posts
    372
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, but I have already searched google and don't want a premade script. Also, the login has to be changable and I don't think that storing it in a variable imbedded into a file is the best way.
    Can anyone help?
    Thanks,
    ttttt
    http://openoffice.org/- Microsoft Office without the Microsoft.
    [home page][forum]
    Versatile, free software

  • #5
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    What kind of help are you looking for? You know if one of us were to write the code to make it work, that would be a pre-made script and you wouldn't be happy with that... so, just what is it you want us to do?

  • #6
    Regular Coder
    Join Date
    Dec 2005
    Posts
    346
    Thanks
    1
    Thanked 0 Times in 0 Posts
    The best way is to look at the pre-made scripts & then just customize it yourself. This way nobody knows what the script looks like.


  •  

    Posting Permissions

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