Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 24, 2012, 09:38:23 AM

Pages: [1]   Go Down
  Print  
Author Topic: Secure a web directory with htaccess and mysql  (Read 1906 times)
neyhard2
Newbie
*
Offline Offline

Posts: 3


« on: January 27, 2011, 11:50:12 AM »

hello,

I want to secure a directory that I share some files with my users.  All the users that I want to have access to those files are in my Joomla user DB.

I have been reading on how to set this up and have been unsuccessful.

here is my .htaccess file that should connect and validate the mysql db
Code:
AuthName "Restricted"
AuthType Basic

AuthMySQLHost localhost
AuthMySQLDB sqldb
AuthMySQLUserTable jos_users
AuthMySQLEnable On
AuthMySQLUser <'username'>
AuthMySQLPassword <'password'>
AuthMySQLNameField username
AuthMySQLPasswordField password
AuthMySQLPwEncryption md5

require valid-user

Any help would be greatly appreciated!

Thank you,
Logged
neyhard2
Newbie
*
Offline Offline

Posts: 3


« Reply #1 on: February 09, 2011, 09:56:42 AM »

 Confused nobody has any ideas?
Logged
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5215



« Reply #2 on: February 09, 2011, 07:22:18 PM »

I've never tried something like this, so the following is just guesswork:

1) Remember that if you are on an LPCP server (not a cPanel server), your database host is not "localhost" but some specific domain name, e.g., sqldb001.lunarzit.com.
2) I'm not sure which field is naming the database, but in most applications (e.g., PHP) it has to be your ACCOUNTNAME_dbname. Probably the same is true here.
3) In most applications, a user name also must be prefixed with ACCOUNTNAME_. Hopefully your users won't have to do that when they type in their ID.

Good luck!
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
neyhard2
Newbie
*
Offline Offline

Posts: 3


« Reply #3 on: February 10, 2011, 05:19:57 AM »

I've never tried something like this, so the following is just guesswork:

1) Remember that if you are on an LPCP server (not a cPanel server), your database host is not "localhost" but some specific domain name, e.g., sqldb001.lunarzit.com.
2) I'm not sure which field is naming the database, but in most applications (e.g., PHP) it has to be your ACCOUNTNAME_dbname. Probably the same is true here.
3) In most applications, a user name also must be prefixed with ACCOUNTNAME_. Hopefully your users won't have to do that when they type in their ID.

Good luck!

Thank you for your reply,

I am on a cPanel server.  Yes my databases are prefixed with my accountname.  I am pretty familiar with setting up php sites to read mysql databases but for some reason this .htaccess is missing something.

Thanks
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: