The Community Forums

Interact with an entire community of cPanel & WHM users.
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Give automatic access to protected directory

Discussion in 'General Discussion' started by waldirlieb, Sep 18, 2007.

  1. waldirlieb

    waldirlieb Registered

    Joined:
    Sep 18, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hi! I have a website which has a directory protected through the "Protect Directory" option of CPanel, in a remote host environment. I want new users, after going through a registration form written in PHP that will add the user to my MySQL database, to have automatic access to this protected directory. How could I achieve this? Thanks.
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Note that cPanel's Protect Directory functionality relies on .htaccess and .htpasswd files to store user credentials, not MySQL databases.
     
  3. waldirlieb

    waldirlieb Registered

    Joined:
    Sep 18, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Password protection

    Yes, I have noticed that. The MYSQL is just to store my user data. When the user register, I need some script to add his login data to the .htpasswd file. The data in this file is stored in the format user : password, but the password is encrypted, and I don't know how it is supposed to be encrypted. I could make a script to write on this file, but how to encrypt the password? Is there any other method?
    Thanks.
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I'd highly recommend looking up a PHP tutorial for this as this isn't a cPanel-specific issue/script.
     
  5. waldirlieb

    waldirlieb Registered

    Joined:
    Sep 18, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I think it is

    Hi, thanks for your replies. I still think it's a CPANEL issue because I need to encrypt the same way as CPANEL does, so it will be able to read the file and do the protection. Well, I will keep looking for it. Thanks.
     
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    For password protected directories, cPanel is merely an interface for Apache's mechanisms. We do not employ our own specific type of encryption for such files.
     
  7. waldirlieb

    waldirlieb Registered

    Joined:
    Sep 18, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Thanks - You are right

    It's not a CPanel issue. It's an Apache and PHP issue. I managed to solve it. I found a PHP class to manipulate htpasswd files in a way compatible with Apache. Thank you.
     
  8. terrya

    terrya Registered

    Joined:
    Apr 19, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Password Encryption Class

    I'm having the same problem in getting the encryption right. Would you mind sharing the class name and where you found it?
    Thanks,
     
Loading...

Share This Page