<?php
require_once('File/HtAccess.php');
/* create a new .htaccess file with given parameters */
$params['authname'] = 'Private';
$params['authtype'] = 'Basic';
$params['authuserfile'] = '/path/to/.htpasswd';
$params['authgroupfile'] = '/path/to/.htgroup';
$params['require'] = array('group', 'admins');
$fh = new File_HtAccess('.htaccess', $params);
$status = $fh->save();
if (PEAR::isError($status)) {
// handle errors
} else {
// continue processing
}
?> |