コード例 #1
0
<?php

include_once '../bootstrap.php';
use Models\SettingsManager;
use Views\SettingsView;
use Views\HomepageView;
use Models\LoginManager;
// login protected page
LoginManager::startSessionAndRedirectIfNotLoggedIn();
$oldEmail = $_REQUEST['OldEmail'];
$newEmail = $_REQUEST['NewEmail'];
$settingsManager = new SettingsManager();
$isEmailUpdateSuccess = $settingsManager->updateEmail($_SESSION['userID'], $oldEmail, $newEmail);
if ($isEmailUpdateSuccess) {
    $SettingsView = new SettingsView(false);
    $SettingsView->render();
    echo "<script type='text/javascript'>alert('Email updated successfully!!')</script>";
    exit;
} else {
    $SettingsView = new SettingsView(true);
    $SettingsView->render();
}
コード例 #2
0
<?php

include_once '../bootstrap.php';
use Models\SettingsManager;
use Views\SettingsView;
use Views\HomepageView;
use Models\LoginManager;
// login protected page
LoginManager::startSessionAndRedirectIfNotLoggedIn();
$oldPassword = $_REQUEST['oldPassword'];
$newPassword = $_REQUEST['newPassword'];
$password_check = $_REQUEST['password_check'];
$settingsManager = new SettingsManager();
$isPasswordUpdateSuccess = $settingsManager->updatePassword($_SESSION['userID'], $oldPassword, $newPassword, $password_check);
if ($isPasswordUpdateSuccess) {
    $SettingsView = new SettingsView(false);
    $SettingsView->render();
    echo "<script type='text/javascript'>alert('Password updated successfully!!')</script>";
    exit;
} else {
    $SettingsView = new SettingsView(true);
    $SettingsView->render();
    //echo "<script type='text/javascript'>alert('submitted unsuccessfully!')</script>";
}