Exemplo n.º 1
0
            break;
        case "insertUser":
            insertUser($mysqli);
            break;
        case "deleteUser":
            deleteUser($mysqli);
            break;
        case "unsetUsername":
            unset($_SESSION['username']);
            unset($_SESSION['password']);
            unset($_SESSION['admin']);
            header("location: index.php");
            break;
    }
}
showAllUsers($mysqli);
?>
                    
                    <form action="?action=unsetUsername" method="post">
                        <input type="submit" class="btn btn-block btn-primary" value="Logout <?php 
echo $username;
?>
">
                    </form>
                <a class="btn btn-block backbutton btn-primary" href="admin_home.php">back</a>
                    </div>


            </div>

Exemplo n.º 2
0
function displayDelUser($config)
{
    if ($config->adminLvl >= 75) {
        $error = '';
        if (isset($_POST['removeBtn'])) {
            // Get user input
            $username = isset($_POST['user_to_Delete']) ? $_POST['user_to_Delete'] : '';
            $error = delUser($username);
        }
        if (isset($_POST['disableBtn'])) {
            // Get user input
            $username = isset($_POST['user_to_Delete']) ? $_POST['user_to_Delete'] : '';
            $userID = getUserID($config, $username);
            $error = disableUser($config, $userID);
        }
        if (!isset($_POST['submitBtn']) || $error != '') {
            ?>
            <a href="<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
?usermenu=true">Back</a>
            <form action="<?php 
            echo $_SERVER['REQUEST_URI'];
            ?>
?DelUserBtn=true" method="post" name="delform">
                <table width="100%"><?php 
            echo '<tr><td align="center"><select name="user_to_Delete">';
            showAllUsers();
            echo '</select>';
            ?>
                </td></tr>
                <tr><td colspan="2" align="center"><input class="text" type="submit" name="removeBtn" value="Delete User" />
                    <input class="text" type="submit" name="disableBtn" value="Disable User" /></td></tr>
                </table>  
            </form>

        <?php 
        }
        if (isset($_POST['removeBtn']) || isset($_POST['disableBtn'])) {
            if (isset($_POST['disableBtn'])) {
                echo '<h2>Disable Results</h2>';
            } else {
                echo '<h2>Deletion result:</h2>';
            }
            ?>
        <div id="icon2">&nbsp;</div>
        <div id="result">
            <table width="100%"><tr><td><br/>
    <?php 
            echo $error;
            ?>
				<br/><br/><br/></td></tr>
			</table>
		</div>
    <?php 
        }
    }
}
Exemplo n.º 3
0
<br>
<br>

<!-- update form -->
<div>
	<span>Update User</span>
	<br>

	<form action="" method="post">
		<input type="text" name="username" placeholder="Enter Username">		
		<input type="password" name="password" placeholder="Enter password">	
		<!-- php populate id selection -->
		<select name="id">
			<!-- each php tag is it's own scope -->
			<?php 
$result = showAllUsers();
while ($row = mysqli_fetch_assoc($result)) {
    $id = $row['id'];
    echo "<option value='{$id}'>{$id}</option>";
}
?>
		</select>	
		<br>
		<input type="submit" name="update">	
	</form>

</div>
<br>
<br>

<!-- create form -->
Exemplo n.º 4
0
<?php

include '../model/userdb.php';
//CRUD users
if ($_POST['method'] == 'insert') {
    insert_user();
}
if ($_POST['method'] == 'getsession') {
    check_session();
}
if ($_POST['method'] == 'getUser') {
    get_user();
}
if ($_POST['method'] == 'showAllUsers') {
    showAllUsers();
}
if ($_POST['method'] == 'updateUser') {
    update_user();
}
if ($_POST['method'] == 'login') {
    loginUser();
}
if ($_POST['method'] == 'logout') {
    logoutUser();
}
if ($_POST['method'] == 'deleteUser') {
    deleteUser();
}