<?php 
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once SITE_ROOT . '/PHP/User.php';
require SITE_ROOT . '/PHP/check_logged_in.php';
$message = '';
$message_class = 'hidden';
if (isset($_POST['form'])) {
    switch ($_POST['form']) {
        case 'PasswordChange':
            try {
                //$password = $_POST['confirm'];
                $email = $_SESSION['user']->getEmail();
                $sk = 1;
                if ($sk = USER::password_update($email, $_POST['confirm'])) {
                    $message = 'Success!';
                    $message_class = 'success';
                } else {
                    $message = 'ERROR: could not update password.';
                    $message_class = 'error';
                }
                $t = $_SESSION['user']->getIsAdmin();
                if ($t == true) {
                    header('Location: ' . SITE_URL . '/front_end/Admin.php');
                }
                $t = $_SESSION['user']->getIsDispatcher();
                if ($t == true) {
                    header('Location: ' . SITE_URL . '/front_end/Dispatcher.php');
                }
                $t = $_SESSION['user']->getIsDriver();