$username = $con->real_escape_string($_POST['username']); $password = $con->real_escape_string($_POST['password']); if ($UserController->login($username, $password)) { header('Location:/index.php'); } else { echo 'Login Failed'; } } if (isset($_POST['ca_submit'])) { if ($_POST['ca_password'] != $_POST['ca_cpassword']) { echo 'Your password does not match'; } else { $username = $con->real_escape_string($_POST['ca_username']); $email = $con->real_escape_string($_POST['ca_email']); $password = $con->real_escape_string($_POST['ca_password']); if ($UserController->create($username, $email, $password)) { echo 'Account Created'; } } } if (isset($_POST['add_submit'])) { if (empty($_POST['add_thread']) || empty($_POST['title'])) { echo 'You did not enter anything'; } else { $user_id = $User['id']; $category_id = $_GET['C']; $title = $_POST['title']; $body = $_POST['add_thread']; if ($ThreadController->create($category_id, $title, $body, $user_id)) { header("Location:/showthread.php?C={$category_id}"); }