PHP Classes

HN_htusers: Manage Apache user and group authentication files

Recommend this page to a friend!
  Info   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 427 All time: 6,342 This week: 660Up
Version License PHP version Categories
hn_htusers 1.1Freely Distributable4.2User Management, Configuration
Description 

Author

This class can be used to manage Apache user and group authentication files.

It can manage Apache .htaccess and .htgroup files to define users, groups and passwords for authentication. Optionally it can manage extra information for users, stored in a third file.

It uses Apache-style MD5-crypt passwords to be portable between win and *nix platforms.

The class provide a forms based user interface to manage the authorization files definitions of users and groups.

It can also perform HTTP basic authentication for users defined in the configuration files directly from PHP instead of having it done by Apache.

This class is based on prior work by Jarno Elonen and Sarah King.

Picture of Horst Nogajski
Name: Horst Nogajski <contact>
Classes: 7 packages by
Country: Germany Germany
Age: 54
All time rank: 534 in Germany Germany
Week rank: 164 Down8 in Germany Germany Down
Innovation award
Innovation award
Nominee: 1x

Recommendations

I need a PHP class for htpasswd manager
Need password management system that uses .htpasswd file.

Details

------------------- hn_htusers README ------------------- package hn_htusers.class.php + hn_htusers.manager.php author Horst Nogajski <info at nogajski.de> version 1.0 date 19. October 2009 A PHP-Class to manage Users and Groups in Apache-Webserver-Environments, optional with extra information in a third file. (htuser htgroup htinfo) The package can be retrieved from http://hn273.users.phpclasses.org/hn_htusers It comes with the two mainfiles (hn_htusers.class.php + hn_htusers.manager.php) a short_documentation.html and some example files 'hosted' in a Frameset for a quick test and compare of different settings. Also you may see in examples: - how to test your setup, - embedd a dynamic ChangePassword-Form into existing HTML-Code, - use HTTP-Auth with .htaccess files in directories, - use HTTP-Auth without .htaccess files, but with PHP, please read the short_documentation.html, look into the examples, as well as into the commented ClassCode. -------------------- hn_htusers HISTORY -------------------- Jarno Elonen created the original script and basic functions in 2004 Sarah King converted the functions to a class and built in user management routines in 2005 Horst Nogajski - built in group-support and extra infos (both optional) - uses Apache-Style MD5-Cryption Passwords. Now works cross-platform (win,unix)! - built in CSS-Styles for more useability - built in Validation (min-max length, allowed Chars) for all entries - LockingMechanism is more robust. Needed, because now every user may send (lots) requests resulting in writeaccess to the file(s), (password or info) - and some more 'hardening' - all in 2009 -------------------- hn_htusers LICENSE -------------------- Copyright (C) 2004 Jarno Elonen <elonen@iki.fi>, <http://elonen.iki.fi/> Copyright (C) 2005 Sarah King <http://sarahk.pcpropertymanager.com/> Copyright (C) 2009 Horst Nogajski <http://hn273.users.phpclasses.org/browse/author/45770.html>, <http://nogajski.de/> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------- md5crypt.php LICENSE ---------------------- Written by - Dennis Riehle <selfhtml@riehle-web.com> http://tutorial.riehle-web.com/scripts/show.php?latest=md5crypt Based on - perl's Crypt::PasswdMD5 by Luis Munoz (lem@cantv.net) - phyton's md5crypt.py by Michal Wallace http://www.sabren.com/ - /usr/src/libcrypt/crypt.c from FreeBSD 2.2.5-RELEASE It's based on the implementation found on FreeBSD 2.2.[56]-RELEASE and contains the following license in it: "THE BEER-WARE LICENSE" (Revision 42): <phk@login.dknet.dk> wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp apache_md5_crypt() provides a function compatible with Apache's .htpasswd files. This was contributed by Bryan Hart <bryan@eai.com>.

Screenshots (4)  
  • screenshots/screen4.jpg
  • screenshots/screen1.jpg
  • screenshots/screen2.jpg
  • screenshots/screen3.jpg
  Files folder image Files (35)  
File Role Description
Files folder imageexamples (5 files, 6 directories)
Plain text file hn_htusers.class.php Class the classfile
Accessible without login Plain text file hn_htusers.manager.php Appl. The Management Script
Accessible without login Plain text file LICENSE.txt Lic. licence
Accessible without login Plain text file README.txt Doc. readme, should be read at first
Accessible without login HTML file short_documentation.html Doc. Documentation, how to initialize, configurate and execute the class

  Files folder image Files (35)  /  examples  
File Role Description
Files folder imageadmins_without_htaccess_file (5 files)
Files folder imageeditors_with_htaccess_file (5 files)
Files folder imageunit_tests (3 files)
Files folder imagevisitors_with_htaccess_file (2 files)
Files folder image_htfiles (4 files)
Files folder image_libs (2 files)
  Plain text file .htaccess Data apache configurationfile, need absolute pathes to htuser- and htgroupfile
  Plain text file example_manager.inc.php Example setup the class in different ways to suit all examples
  HTML file index.html Example Frameset that hosts examples
  HTML file index2.html Example Menuframe with all Example-Links
  HTML file index3.html Example examples welcome screen ;-)

  Files folder image Files (35)  /  examples  /  admins_without_htaccess_file  
File Role Description
  Plain text file example.woh1.php Example Form to Admins, only with htusers
  Plain text file example.woh2.php Example Form to Admins, with htusers and htinfos
  Plain text file example.woh3.php Example Form to Admins, with htusers and htgroups
  Plain text file example.woh4.php Example Form to Admins, with htusers, htinfos and htgroups
  Plain text file htaccess.inc.php Example HTTP authentication with PHP

  Files folder image Files (35)  /  examples  /  editors_with_htaccess_file  
File Role Description
  Plain text file .htaccess Data apache configurationfile
  Plain text file example.wh1.php Example Form to NonAdmins, only with htusers
  Plain text file example.wh2.php Example Form to NonAdmins, with htusers and htinfos
  Plain text file example.wh3.php Example Form to NonAdmins, with htusers and htgroups
  Plain text file example.wh4.php Example Form to NonAdmins, with htusers, htinfos and htgroups

  Files folder image Files (35)  /  examples  /  unit_tests  
File Role Description
  Plain text file .htaccess Data apache configuration file
  Plain text file setup_test.php Test Setup / Configuration Test, should be run, after (new) installion
  Plain text file unit_test.php Test Unit-Test, loads data and run test, independent from htfiles

  Files folder image Files (35)  /  examples  /  visitors_with_htaccess_file  
File Role Description
  Plain text file .htaccess Data apache configurationfile
  Plain text file index.php Example shows how to embedd a form for password-changes into existing pages

  Files folder image Files (35)  /  examples  /  _htfiles  
File Role Description
  Plain text file .htaccess Data apache configurationfile
  Plain text file .htgroup Data apache configurationfile, contains groupnames and groupmembers
  Plain text file .htinfo Data apache configurationfile, contains user : extended-info combinations
  Plain text file .htuser Data apache configurationfile, contains user : encryptedpassword combinations

  Files folder image Files (35)  /  examples  /  _libs  
File Role Description
  Plain text file .htaccess Data apache configurationfile
  Plain text file example_class.inc.php Class Classfile for examples

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:427
This week:0
All time:6,342
This week:660Up