diff --git a/create.php b/create.php index 1bab151..ec2d3c7 100644 --- a/create.php +++ b/create.php @@ -93,13 +93,13 @@ Home
  • - New Post + New Post
  • Register User
  • - User list + User list
  • diff --git a/editUsers.php b/editUsers.php new file mode 100644 index 0000000..3f3d7ca --- /dev/null +++ b/editUsers.php @@ -0,0 +1,95 @@ +prepare($query); + + // Execution on the DB server is delayed until we execute(). + $statement->execute(); + + $userdata = $statement->fetch(); + echo($userdata['name']); +} +?> + + + + + + + + + + Edit users! + + + + +
    + + +
    +
    +
    + Edit Blog Post +

    + + + +

    +

    + + +

    +

    + + +

    +

    + > + + +

    +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/userList.php b/userList.php index a3f2b2c..b4c3055 100644 --- a/userList.php +++ b/userList.php @@ -62,6 +62,7 @@ User email:

    Role:

    + edit

    diff --git a/user_post.php b/user_post.php new file mode 100644 index 0000000..74ecd75 --- /dev/null +++ b/user_post.php @@ -0,0 +1,86 @@ +prepare($query); + + // Bind values to the parameters + $statement->bindValue(":name", $name); + $statement->bindValue(":email", $email); + $statement->bindValue(":user_lvl", $user_lvl); + $statement->bindValue(":user_id", $user_id); + + // Execute the UPDATE. + // execute() will check for possible SQL injection and remove if necessary + if ($statement->execute()) { + header("Location: userList.php"); + exit; + } + + } else if (isset($_POST['delete'])) { + // Sanitize user input to escape HTML entities and filter out dangerous characters. + $user_id = filter_input(INPUT_POST, 'user_id', FILTER_VALIDATE_INT); + + // Build the parameterized SQL query and bind to the above sanitized values."; + $query = "DELETE FROM users WHERE user_id = :user_id"; + $statement = $db->prepare($query); + + // Bind values to the parameters + $statement->bindParam(":user_id", $user_id); + + // Execute the DELETE. + // execute() will check for possible SQL injection and remove if necessary + if ($statement->execute()) { + header("Location: userList.php"); + exit; + } + } + +} else { + $errorMessage = "The tweet message or title is empty"; +} + + +?> + + + + + + + + + + My Drip Post! + + + + + +

    + +

    + + + + \ No newline at end of file