Beispiel #1
0
// require the session
require_once 'session.php';
// check if the script was called from the pression of the button
if (isset($_POST["update"])) {
    // get out the value of the port array
    $key = $_POST["key"];
    $value = $_POST["value"];
    // include the Matchup classes
    require_once 'Matchup.inc.php';
    // create an object of MUUsers
    $user = new MUUsers();
    // select which is the case here and what to do
    switch ($key) {
        case "nome":
            // update the name
            $user->changeName($_SESSION["username"], $value);
            break;
        case "cognome":
            // update the surname
            $user->changeSurname($_SESSION["username"], $value);
            break;
        case "password":
            // update the password
            $user->changePassword($_SESSION["username"], $value);
            break;
        default:
            // redirect to home.php and exit the script
            header("location: home.php");
            exit;
            break;
    }