<?php
session_start();
include_once 'http.auth.cls.php';
function chk_my_user_simple($p_user, $p_pass){
$users=array('demo'=>'demo', 'admin'=>'admin1', 'user'=>'admin2');
if(isset($users[$p_user]) && $users[$p_user]==$p_pass) return true;
}
$httpauth=new HTTPBasicRealmAuth('authentication by function', 'chk_my_user_simple');
/**/
/*
class myWebsiteUsers{
var $users;
function __construct(){
$this->users['admin']=$this->encrypt('admin1');
$this->users['demo']=$this->encrypt('admin2');
$this->users['user']=$this->encrypt('admin3');
$this->users['client']=$this->encrypt('admin4');
}
function encrypt($p_subject){ return md5($p_subject); }
}
function chk_my_user($p_user, $p_pass){
$usr=new myWebsiteUsers();
if(isset($usr->users[$p_user]) && $usr->users[$p_user]==$p_pass) return true;
}
$user=new myWebsiteUsers();
$httpauth=new HTTPBasicRealmAuth('authentication by function', NULL, 'chk_my_user', true, false);
$httpauth->setPasswordEncryptMethod(array($user, 'encrypt'));
$httpauth->setEncryptedPasswordFlag(true);
$httpauth->check();
*/
include 'secure.file.eg.php';
|