PHP Classes

File: hn_htusers.manager.php

Recommend this page to a friend!
  Classes of Horst Nogajski   HN_htusers   hn_htusers.manager.php   Download  
File: hn_htusers.manager.php
Role: Application script
Content type: text/plain
Description: The Management Script
Class: HN_htusers
Manage Apache user and group authentication files
Author: By
Last change:
Date: 14 years ago
Size: 2,027 bytes
 

Contents

Class file image Download
<?php
/*******************************************************************************\
  * @script_type - PHP-Script
  * @php_version - 4.2.x
  * @scriptname - auth.php (for use with hn_htaccess.class.php)
  * ---------------------------------------------------------------------------
  * $Source: /web/hn_htaccess_Manager/hn_htusers.manager.php,v $
  * $Id: hn_htusers.manager.php,v 1.3 2009/10/19 15:17:30 horst Exp $
\*******************************************************************************/



# define HTPASSWDPATH and HTUSERFILE is mandatory,
# define (and use) HTGROUPFILE or HTINFOFILE both is optional

   
define('HTPASSWDPATH', dirname(__FILE__).'/');
   
define('HTUSERFILE', '.htuser');
   
define('HTGROUPFILE', '.htgroup');
   
define('HTINFOFILE', '.htinfo');



# embedd classfile (better store it at a different place)

   
require_once('./hn_htusers.class.php');



# initialize the class
    # param 1: URL of this script, needed for Redirections and Formactions
    # param 2: (optional) array with admin-userid/s
    # param 3: (optional) name of the admin group

   
$ht = new hn_htusers($_SERVER['PHP_SELF'], array('horst','admin'), 'admins');
   
#$ht->setup_test();


# now we load the file(s)
# if there are any errors, it returns false, ...

   
if(!$ht->load_files())
    {
       
# ... and we should read the errors and exit
       
echo $ht->errors;
        exit(
1);
    }



# if file(s) are loaded successfully, we switch to desired operation

   
switch($ht->getGetVar('op','manage'))
    {
        case
'adduser':
           
$ht->add_user();
            break;
        case
'savepwd':
           
$ht->save_password();
            break;
        case
'delete':
           
$ht->delete_user();
            break;
        case
'chgpwd':
            echo
$ht->change_pwd_request(FALSE,TRUE);
            break;
        case
'addgroup':
           
$ht->add_group();
            break;
        case
'delgroup':
           
$ht->delete_group();
            break;
        case
'user2groups':
           
$ht->set_user2groups();
            break;
        case
'manage':
        default:
           
$ht->manage_users();
            break;
    }

exit(
0);

?>