Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-30-2006, 03:54 PM   PM User | #1
jedimastermopar
Regular Coder

 
Join Date: Nov 2006
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
jedimastermopar is an unknown quantity at this point
best way to Authentication

Well, I have a website I want to allow un authenticated access to. Then I have several directories of html and php files that I want to password protect. What is the best way to do this? I can do it with .htaccess but I don't think anyone likes to use that anymore? Is there an easyish way to setup a small db to store usernames, password and group and then set the directories to allow groups in? I would need to be able to have people belong to multiple groups as some people will have access to more than one authenticated directory.
jedimastermopar is offline   Reply With Quote
Old 11-30-2006, 04:00 PM   PM User | #2
jedimastermopar
Regular Coder

 
Join Date: Nov 2006
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
jedimastermopar is an unknown quantity at this point
I read this file but I am unsure of the <directory> part and how you assign a group to a particular directory. Has anyone used this method of securing a website?
also I am not sure where you type in the <directory> part is that a set of commands to be run in mysql? or is that a file you put in the directory or what?

# CREATE DATABASE auth;
# USE auth;
# CREATE TABLE users (
# user_name CHAR(30) NOT NULL,
# user_passwd CHAR(20) NOT NULL,
# PRIMARY KEY (user_name)
# );
# CREATE TABLE groups (
# user_name CHAR(30) NOT NULL,
# user_group CHAR(20) NOT NULL,
# PRIMARY KEY (user_name, user_group)
# );
# GRANT SELECT
# ON auth.users
# TO authuser@localhost
# IDENTIFIED BY 'PaSsW0Rd';
# GRANT SELECT
# ON auth.groups
# TO authuser@localhost
# IDENTIFIED BY 'PaSsW0Rd';
#
# INSERT INTO users VALUES ('testuser', ENCRYPT('testpass'));
# INSERT INTO groups VALUES ('testuser', 'user');
# INSERT INTO users VALUES ('testadmin', ENCRYPT('testpass'));
# INSERT INTO groups VALUES ('testadmin', 'admin');
# INSERT INTO groups VALUES ('testadmin', 'user');
#
#<Directory /var/www>
# AuthName "MySQL group authenticated zone"
# AuthType Basic
#
# AuthMySQLEnable on
# AuthMySQLUser authuser
# AuthMySQLPassword PaSsW0Rd
# AuthMySQLDB auth
# AuthMySQLUserTable users
# AuthMySQLNameField user_name
# AuthMySQLPasswordField user_passwd
# AuthMySQLGroupTable groups
# AuthMySQLGroupField user_group
#
# require group user
#</Directory>
jedimastermopar is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:52 AM.


Advertisement
Log in to turn off these ads.