diff --git a/post.php b/post.php index d1a61d4..214b653 100644 --- a/post.php +++ b/post.php @@ -7,13 +7,13 @@ function validate_iamge() { } // function to handle the creation of a new thread -function new_thread(string $board_code, string $title, string $username) { +function new_thread(string $board_id, string $title, string $username) { $conn = get_database_conn(); $insert_thread_sql = "INSERT INTO thread (title, user_id, board, posted) VALUES (?, (SELECT id FROM user WHERE username = ?), ?, NOW())"; $stmt = mysqli_prepare($conn, $insert_thread_sql); - mysqli_stmt_bind_param($stmt, "sss", $title, $username, $board_code); + mysqli_stmt_bind_param($stmt, "sss", $title, $username, $board_id); mysqli_stmt_execute($stmt); if (mysqli_stmt_affected_rows($stmt) != 1) { @@ -37,7 +37,7 @@ if ($_POST['type'] == 'new_thread') { // get the variables from the post request $title = $_POST['title'] or die('invalid request!'); $upload = $_POST['upload'] or die('invalid request!'); - $board_code = $_POST['board_code'] or die('invalid request!'); + $board_id = $_POST['board_id'] or die('invalid request!'); $message = $_POST['message'] ?? ''; // get the posters username @@ -50,7 +50,7 @@ if ($_POST['type'] == 'new_thread') { //todo: validate the image and move it into the filesystem - $thread_id = new_thread($board_code, $title, $username); + $thread_id = new_thread($board_id, $title, $username); } elseif ($_POST['type'] == 'thread_reply') { } else {