<?php 
ini_set('session.gc_maxlifetime', 3600*3);
session_start();
// Valid constant names

class AuthController {
    const PASSWD = 123;
    const LOGIN  = "none@none.ru";
    const DOMAIN = 'http://localhost:8080/';
    
    public $login = Null;
    public $password = Null;

    public function __construct()
    { 
        $this->login = $_POST['login'];  
        $this -> password = $_POST['password'];
    }

    public function actionLogin(){

        if (( $this->login  == self::LOGIN ) AND ( $this -> password == self::PASSWD )) {
            // редирект в админку
            $_SESSION['IS_AUTH'] = true;
            header("Location:". self::DOMAIN . "admin");
        } else {
            // редирект на форму логина с предупреждением
            header('Location:'. self::DOMAIN . "login" );
        }
    }

    public function actionLogout(){
        session_unset();
        session_destroy();
        // echo('print Logout');
        header( 'Location:'. self::DOMAIN );
    }
}