#native_company# #native_desc#
#native_cta#

phpaccess

By Sven Wagener
on January 15, 2002

Version: 0.1

Type: Full Script

Category: HTTP

License: GNU General Public License

Description: The htaccess class manages the htaccess functions of Apache Webservers. Without knowing much knowledge of Apache, users can be added or deleted, groups can be created anddeleted, .htaccess files can be created with this class etc.

<?

/**
* Class for handling htaccess of Apache
* @author    Sven Wagener <[email protected]>
* @copyright Intertribe - Internetservices Germany
* @include 	 Funktion:_include_
*/

class htaccess{
    var $fHtaccess=""; // path and filename for htaccess file
    var $fHtgroup="";  // path and filename for htgroup file
    var $fPasswd="";   // path and filename for passwd file
    
    var $authType="Basic";
    var $authName="Internal Area";

    function htaccess(){
    }
    
    function setFHtaccess($filename){
        $this->fHtaccess=$filename;
    }

    function setFHtgroup($filename){
        $this->fHtgroup=$filename;
    }

    function setFPasswd($filename){
        $this->fPasswd=$filename;
    }
    
    function addUser($username,$password,$group){
        $file=fopen($this->fPasswd,"a");

        $password=crypt($password);
        $newLine=$username.":".$password."n";

        fputs($file,$newLine);
        fclose($file);
    }
    
    function addGroup($username,$password){
        $file=fopen($this->fHtgroup,"a");
        fclose($file);
    }

    function delUser($username){
        $file=fopen($path.$this->fHtaccess,"r+");
        fclose($file);
    }
    
    function getUsers(){
    }
    
    function setPasswd($username,$password){
    }
    
    function setAuthType($authtype){
        $this->authType=$authtype;
    }
    
    function setAuthName($authname){
        $this->authName=$authname;
    }

    function addLogin($path,$authname){
       if($authname!=""){
          $this->authName=$authname;
       }
       $file=fopen($path.$this->fHtaccess,"w+");
       fputs($file,"Order allow,denyn");
       fputs($file,"Allow from alln");
       fputs($file,"AuthType        ".$this->authType."n");
       fputs($file,"AuthUserFile    ".$this->fPasswd."nn");
       fputs($file,"AuthName        "".$authname.""n");
       fputs($file,"require valid-usern");
       fclose($file);
    }
    function delLogin($path){
        unlink($path.$this->fHtaccess);
    }
    
    function isAllSet(){
    }
}
?>