updateSql.php 889 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. include_once(__DIR__ . "/auth.php");
  3. include_once("requestDB.php");
  4. if (isset($_POST["message"])){
  5. queryw("INSERT INTO `post` (`postid`, `username`, `content`, `posttime`) VALUES (NULL, '" . $_SESSION['login'] . "', '" . $_POST["message"] . "', CURRENT_TIMESTAMP)","teabag");
  6. }
  7. header("Location: index.php");
  8. /*
  9. $conn = mysqli_connect("localhost","root","","message");
  10. if($conn->connect_error)
  11. {
  12. echo "Unable to connect to database";
  13. exit;
  14. }
  15. //$sql = "INSERT INTO `message` (`user`, `datetime`, `messgae`, `id`) VALUES ('".$_SESSION['login']."', current_timestamp(), '".$_POST[message]."', NULL);";
  16. $stmt = $conn->prepare("INSERT INTO `message` (`user`, `datetime`, `messgae`, `id`) VALUES (?, current_timestamp(),?, NULL);");
  17. $stmt->bind_param("ss", $_SESSION['login'], $_POST[message]);
  18. $stmt->execute();
  19. $stmt->close();
  20. $conn->close();
  21. header("Location: index.php");
  22. */
  23. ?>