| 
<?php
 class myWebsiteUsers{
 
 var $users;
 function fixUser(){
 $this->users['demo']='demo';
 $this->users['admin']='admin1';
 $this->users['user']='admin2';
 $this->users['client']='admin3';
 }
 function fixUserSecure(){
 $this->users['demo']=$this->encrypt('demo');
 $this->users['admin']=$this->encrypt('admin1');
 $this->users['user']=$this->encrypt('admin2');
 $this->users['client']=$this->encrypt('admin3');
 }
 
 function encrypt($p_subject){ return md5($p_subject); }
 private function isUserOKX($p_user, $p_pass, $p_secure=false){
 $this->fixUser();
 if($p_secure) $this->fixUserSecure();
 if(isset($this->users[$p_user]) && $this->users[$p_user]==$p_pass) return true;
 }
 function isUserOK($p_user, $p_pass){ return $this->isUserOKX($p_user, $p_pass); }
 function isUserOKSecured($p_user, $p_pass){ return $this->isUserOKX($p_user, $p_pass, true); }
 
 }
 
 
 
 session_start();
 include_once 'http.auth.cls.php';
 $user=new myWebsiteUsers();
 #$httpauth=new HTTPBasicRealmAuth('authentication by custom class', $user, 'isUserOK');
 $httpauth=new HTTPBasicRealmAuth('authentication by custom class', $user, 'isUserOKSecured', true, false);
 $httpauth->setPasswordEncryptMethod(array($user, 'encrypt'));
 $httpauth->setEncryptedPasswordFlag(true);
 $httpauth->check();
 
 
 include 'secure.file.eg.php';
 |