//Include menu options applicable to all pages of the web site
include "PhpSampleTemplate.php";
?>

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>
            Delete User
        </title>
    </head>
    <body>
        <?php 
// If this was not a post back show the delete user form
if (!isset($_POST['submit'])) {
    $user = GraphServiceAccessHelper::getEntry('users', $_GET['id']);
    echo '<H1>Do you really want to delete this user?<H1>';
    echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $_GET['id'] . '">';
    echo '<table>';
    echo '<tr><td><b>Display Name:</b></td><td><input type="text" disabled size="20" maxlength="100" name="dname" value="' . $user->{'displayName'} . '"></td></tr>';
    echo '<tr><td><b>Mail Alias:</b></td><td><input type="text" disabled size="20" maxlength="15" name="alias" value="' . $user->{'mailNickname'} . '"></td></tr>';
    echo '<input name="id" type="hidden" value=' . $_GET['id'] . '>';
    echo '<tr><td><input type="submit" value="Delete" name="submit"></td></tr>';
    echo '</table>';
    echo '</form>';
} else {
    // Delete the user and display a message
    $user = GraphServiceAccessHelper::deleteEntry('users', $_POST['id']);
    //Check to see if we got back an error.
    if (!empty($user->{'odata.error'})) {
        $message = $user->{'odata.error'}->{'message'};
//Include menu options applicable to all pages of the web site
include "PhpSampleTemplate.php";
?>

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>
            Delete Group
        </title>
    </head>
    <body>
        <?php 
// If this was not a post back show the delete group form
if (!isset($_POST['submit'])) {
    $group = GraphServiceAccessHelper::getEntry('groups', $_GET['id']);
    echo '<H1>Do you really want to delete this group?<H1>';
    echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $_GET['id'] . '">';
    echo '<table>';
    echo '<tr><td><b>Display Name:</b></td><td><input type="text" disabled size="20" maxlength="100" name="dname" value="' . $group->{'displayName'} . '"></td></tr>';
    echo '<tr><td><b>Group:</b></td><td><input type="text" disabled size="20" maxlength="15" name="alias" value="' . $group->{'description'} . '"></td></tr>';
    echo '<input name="id" type="hidden" value=' . $_GET['id'] . '>';
    echo '<tr><td><input type="submit" value="Delete" name="submit"></td></tr>';
    echo '</table>';
    echo '</form>';
} else {
    // Delete the group and display a message
    $group = GraphServiceAccessHelper::deleteEntry('groups', $_POST['id']);
    //Check to see if we got back an error.
    if (!empty($group->{'odata.error'})) {
        $message = $group->{'odata.error'}->{'message'};