if (!$userinfo['access'] || in_array('-1', $access)) {
    $eve->SessionSetVar('errormsg', 'You don\'t have access to this tracker!');
    $eve->RedirectUrl('index.php');
}
$action = $eve->VarCleanFromInput('action');
if ($action == 'changeinfo') {
    $theme_id = $eve->VarCleanFromInput('theme_id');
    $user_track_display = $eve->VarCleanFromInput('user_track_display');
    $user_track_sort = $eve->VarCleanFromInput('user_track_sort');
    $trackArray = array($user_track_display, $user_track_sort);
    $user_track = implode(".", array_filter($trackArray));
    $away = $eve->VarCleanFromInput('away');
    $email = $eve->VarCleanFromInput('email');
    $newpass = $eve->VarCleanFromInput('newpass');
    $newpass2 = $eve->VarCleanFromInput('newpass2');
    if ($posmgmt->UpdateUserSettings(array('id' => $userinfo['id'], 'newtheme' => $theme_id, 'new_user_track' => $user_track, 'newaway' => $away))) {
        $eve->SessionSetVar('statusmsg', 'User Settings Updated!');
        $eve->RedirectUrl('user.php');
    }
    if (!empty($email) && $email != $userinfo['email']) {
        if ($posmgmt->UpdateUserMail(array('id' => $userinfo['id'], 'newmail' => $email))) {
            $eve->SessionSetVar('statusmsg', 'New email address saved!');
            $eve->RedirectUrl('user.php');
        }
    }
    if (!empty($newpass) && $newpass != $newpass2) {
        $eve->SessionSetVar('errormsg', 'Password and confirmation password are different!');
        $eve->RedirectUrl('user.php');
    }
    if ($newpass) {
        if (!$posmgmt->UpdateUserPass(array('id' => $userinfo['id'], 'newpass' => $newpass))) {