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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts

    [URGENT] Adding an htaccess user

    Is this possible? I have the code i need to update a password, but is there a way to create a new user using PHP, or exec, or anything I can put in a webpage, and feed information to from a form?

    The server I am on also has cPanel BTW

    I need this as soon as possible!!

    Thank you.
    If I'm postin here, I NEED YOUR HELP!!

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    UK
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could use the htpasswd program via exec to add users to your .htpasswd file

    As long as .htaccess is set to require valid-user then it should allow any user in .htpasswd

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Another option would be to create these files yourself, as .htaccess will allow you to specify what file it will read for authentication. Of course, keep this above your web root directory.
    Heres a perl example:
    Code:
    use DB_File;
    tie %database, 'DB_File', "passwords.dat"
        or die "Can't initialize database: $!\n";
    
    $username = 'rbowen';
    $password = 'mypassword';
    @chars=(0..9,'a'..'z');
    $salt = $chars[int rand @chars] . $chars[int rand @chars];
    
    $crypt = crypt($password, $salt);
    $database{$username} = $crypt;
    
    untie %database;
    Looking at it seems easy enough, create a random two digit password salt containing alphanumeric characters, and crypt your password. Its been years since I've used perl, and frankly my perl skills were not great to start with, but so long as the crypt function is the same, you're good to go. No guarentees though.


  •  

    Posting Permissions

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