Ejemplo n.º 1
0
if ($mode == "user") {
    $usn = $_POST['u_username'];
    $pwd = $_POST['u_password'];
    $role_code = $_POST['u_rolecode'];
    $name = $_POST['u_name'];
    $btn = $_POST['btn'];
    $user = array($usn, $pwd, $role_code, $name);
    if ($btn == "u_submit") {
        if ($db->insertUser($user) > 0) {
            echo '<label class="control-label" for="inputSuccess">New user created successfully</label> <br \\> Return to <a href="dashboard.php" >Dashboard</a>';
        } else {
            echo '<label class="control-label" for="inputError">New user was not created.</label><br \\>Return to <a href="dashboard.php" >Dashboard</a>';
        }
    } else {
        if ($btn == "u_update") {
            if ($db->editUser($user, $user_id) > 0) {
                echo '<label class="control-label" for="inputSuccess">User details updated successfully</label> <br \\> Return to <a href="dashboard.php" >Dashboard</a>';
            } else {
                echo "id = " . $user_id;
                echo '<label class="control-label" for="inputError">User details was not updated.</label><br \\>Return to <a href="dashboard.php" >Dashboard</a>';
            }
        }
    }
} else {
    if ($action != "add" && $action != "edit" && $action != "delete") {
        ?>
                                    
                                    <div class="table-responsive">
                                        <a href="admin.php?action=add"  class="fa fa-pencil"> Add new</a>
                                        <table class="table table-striped table-bordered table-hover">
                                            <thead>