error_reporting(1);
if(!defined("_rights_class")){
define("_rights_class", 1);
class rights {
var $pathes;
function addRight($path){
if(sizeof($this->pathes) == 0)
$this->pathes = array($path);
else
$this->pathes[] = $path;
}
function removeRight($path){
for($i=0; i < count($this->pathes); $i++):
if($this->pathes[$i] == $path){
unset($this->pathes[$i]);
break;
}
endfor;
}
function ammount(){
return sizeof($this->pathes);
}
function isForMembersOnly($path){
foreach($this->pathes as $current){
if(strpos($path, $current) !== false){
return true;
}
}
return false;
}
function printRights(){
foreach ($this->pathes as $path)
echo $path . "
";
}
function save(){
$s = serialize($this->pathes);
$fp = fopen("rights.data", "w");
fputs($fp, $s);
fclose($fp);
}
function open(){
if($lines = file("rights.data")){
$s = implode("", $lines);
$this->pathes = unserialize($s);
return true;
}
$this->pathes = array();
return false;
}
}
}
?>
error_reporting(1);
if(!defined("_users_class")){
define("_users_class", 1);
class users {
var $accounts;
function addAccount($username, $password){
if(sizeof($this->accounts) == 0)
$this->accounts = array($username=>$password);
else
$this->accounts[$username] = $password;
}
function removeAccount($username){
foreach ($this->accounts as $user => $passwd)
if($user == $username)
unset($this->accounts[$username]);
}
function ammount(){
return sizeof($this->accounts);
}
function getPassword($username){
return $this->accounts[$username];
}
function setPassword($username, $password){
addAccount($username, $password);
}
function printAccounts(){
echo "
";
foreach ($this->accounts as $user => $passwd)
echo $user . ": " . $passwd . " ";
echo " |
";
}
function save(){
$s = serialize($this->accounts);
$fp = fopen("users.data", "w");
fputs($fp, $s);
fclose($fp);
}
function open(){
if($lines = file("users.data")){
$s = implode("", $lines);
$this->accounts = unserialize($s);
return true;
}
$this->accounts = array();
return false;
}
}
}
?>
bjoern-mayer.de