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/lab.komma-mediadesign.nl/wwwroot/lab/controllers/c_login.class.php
<?php
/**
 * c_login.class.php
 * Created by Komma Mediadesign.
 * Author: mike
 * Date: 3/20/13
 */

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

    /*
     * Shows the login form
     */
    public function index()
    {
        /*
         * Create Submit Button and send data to the view
         */
        $sbm = new Button(array('type'=>'submit','name'=>'login_submit','label'=>'login'));
        $sbm->addClasses(array('blue', 'login-submit'));
        $this->View->setData('submit',$sbm->display(FALSE));

        /*
         * Set Page Title
         */
        $this->View->setData('page_title','Login Form | ' . SITE_NAME);
        $this->View->setData('page_name','page-login');

        /*
         * Load JS file for login page.
         */
        $this->View->setData('js_output','<script type="text/javascript" src="' . SITE_ROOT . 'js/login.js"></script>');

        /*
         * Render the View
         */
        $this->View->render('login/v_form');
    }

    /*
     * Shows the "i forgot my password" page
     */
    public function forgotPass()
    {
        echo 'forgot pass';
    }

    /*
     * Validates the login form and sends a message.
     */
    public function validate()
    {
        echo 'validate';

        if($this->Model->validate())
        {
            $msg = 'Success!';
            $this->Alert->set($msg,'success');
        }
        else
        {
            $e = $this->Model->getErrors();
            $this->Alert->set($e,'error');
        }
        $this->Functions->redirect(SITE_ROOT);
    }

    /*
     * Log out
     */
    public function logOut()
    {
        $this->Model->logOut();
        $this->Alert->set('Log out success','success');
        $this->Functions->redirect(SITE_ROOT);
    }
}