<?php
	require_once( $GLOBALS["site_root"]."/includes/widgets/Widget.inc.php" );
	require_once( $GLOBALS["site_root"]."/includes/models/AdminUser.inc.php" );

	class BackendLogin extends Widget {

		public function handleEvents() {
			if (AdminUserModel::isAdminLoggedIn()) {
				parent::handleEvents();
				return;
			}
			if (!isset( $this->aP["smb_login"] )) {
				parent::handleEvents();
				return;
			}
			if (!isset( $this->aP["username"] )) {
				parent::handleEvents();
				return;
			}
			if (!isset( $this->aP["password"] )) {
				parent::handleEvents();
				return;
			}

			if ($this->aP["username"]!="mediaonline") {
				parent::handleEvents();
				return;
			}
			if ($this->aP["password"]!="Marci9Fo") {
				parent::handleEvents();
				return;
			}
			AdminUserModel::loginAdmin();
			FNTH_redirect( $_SERVER["REQUEST_URI"] );
		}
	}
?>
