KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/simes/unused/fCMSBackend/includes/userdb/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/simes/unused/fCMSBackend/includes/userdb/userdb.php
<?php

require_once "./includes/xpath/xpath.php";

function factory_userdb () {
	return new UserDB ();
}

class UserDB {
	var $xp;
	var $users;

	function UserDB () {
		$path = "./config/users.xml";
		$this->xp = new FCMSXPath ();
		$this->xp->parse ($path);

		$this->initUsersDict ();
	}

	function getUserGroup ($user) {
		$d = $this->users [$user];
		if (! $d) return "";

		return $d ['group'];
	}

	function checkUser ($user, $pass) {
		$d = $this->users [$user];
		if (! $d) return "";

		return ($pass == $d ['password']);
	}

	# ----- Internal

	function initUsersDict () {
		$base_xpath = "/groups";
		$xp =& $this->xp;
		$this->users = array ();
		
		$group_nodes = $xp->match ($base_xpath . '/group');
		foreach ($group_nodes as $group_node) {
			$group = $xp->getAttribute ($group_node, 'name');
			
			$g_xpath = $base_xpath . '/group[@name="' . $group . '"]/users';
			$unodes = $xp->match ($g_xpath . '/user');

			foreach ($unodes as $usernode) {
				$name = $xp->getAttribute ($usernode, 'name');
				$pass = $xp->getAttribute ($usernode, 'password');

				$d = array ();
				$d ['name'] = $name;
				$d ['password'] = $pass;
				$d ['group'] = $group;

				$this->users [$name] = $d;
			}
		}
	}

}


?>

Anon7 - 2021