<?php
/**
 * User: David Camacho
 * Date: 31/03/2015
 * Time: 3:55
 */
include_once './config/settings.php';
include_once "./controllers/DatabaseController.php";
include_once "./classes/User.php";
class MainController{

        var $role;

        public function MainController()
        {

            session_start();
            $user = new User();
            $role = $user->getRole();
            session_write_close();


            //role check
            if (isset($role)) {
                if ($role == 0) {
                    include_once "./controllers/StudentController.php";
                    $this->student = new StudentController();
                } elseif($role == 1) {
                    include_once "./controllers/TeacherController.php";
                    $this->student = new TeacherController();
                }else header('Location: login.php');
            }else header('Location: login.php');


        }
}
