Location: PHPKode > projects > HERMES PHP-Based Business Mgmt > hermes-0.4.1/pam.d/pam_db_shared/pam.php
<?
function login ($username, $password){
	$connection=dbconnect($username, $password);
	$row = FetchArray(SQLQuery(
		"SELECT sh_authenticate('$username', '$password')"
	));
	if ($row[0] == 'f'){
		return false;
	}`
	$user_info=FetchArray(SQLQuery(
		"SELECT *, CASE WHEN admin='1' 
				THEN 1 
				ELSE 0 
				END 
			AS is_admin 
		FROM owners WHERE login='$username'"
	));

	$current_user = new HermesCurrentUser(
				$username, $password, $user_info["owner_id"],
				$user_info["is_admin"], "owners"
			);
	$current_user->NewConnection("rdbms", $connection);

	if (!$connection){
		print "Login failed<br>";
		unset ($GLOBALS["password"]);
		return false;
	}
	return $current_user;
}
Return current item: HERMES PHP-Based Business Mgmt