HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/kms.komma.pro/wwwroot/app/controllers/c_login.class.php
<?php
/**
 * Created by Komma.pro
 * User: mikevandersanden
 * Date: 18/9/13
 */

class Login extends Controller
{
    public function __construct()
    {
        parent::__construct();
    }

    /*
     * Show login form
     */
    public function index()
    {
        // Create submit button
        $sbm = new Button(array('type'=>'submit','name'=>'login_submit','label'=> $this->lang['login'] ));
        $sbm->addClasses(array('blue'));
        $this->View->setData('submit',$sbm->display(FALSE));

        // Page Title
        $this->View->setData('page_title', $this->lang['login'] . ' | ' . SITE_NAME );

        // Show form
        $this->View->render('login/v_form');
    }

    /*
     * Login
     */
    public function login()
    {
        // Open the gate
        if($this->Model->openGate())
        {
            // Redirect to dashboard
            Fn::redirect( LANG_ROOT );
        }
        else
        {
            // Set errors in the session
            $errors = $this->Model->getErrors();
            $msg = '';
            foreach($errors as $key => $error)
            {
                if($key!=0) $msg .= '<br />';
                $msg .= $error;
            }
            $this->Alert->set($msg,'error');

            // Check for login attempts
            Session::get('login_attempt') ? $attempt = Session::get('login_attempt') : $attempt = 0;
            $attempt++;
            Session::set('login_attempt',$attempt);

            // Redirect back to login page
            Fn::redirect( LANG_ROOT . $this->urls['login']);
        }
    }

    /*
     * Logout
     */
    public function logout()
    {
        $this->Model->closeGate();
        Fn::redirect( LANG_ROOT );
    }
}