Advertisement
Guest User

Untitled

a guest
May 24th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ?>
  4.  
  5. <?php
  6. $servername = "localhost";
  7. $username = "root";
  8. $password = "";
  9. $dbname = "pocztadb";
  10.  
  11. // Create connection
  12. $conn = new mysqli($servername, $username, $password, $dbname);
  13. // Check connection
  14. if ($conn->connect_error) {
  15.     die("Connection failed: " . $conn->connect_error);
  16. }
  17.  
  18. $nadawca = $_SESSION['nick'];
  19. $odbiorca = $_POST['odbiorca'];
  20. $tytul = $_POST['tytul'];
  21. $tresc = $_POST['tresc'];
  22.  
  23. if($odbiorca == "" || $tytul == "" || $tresc == "")
  24. {
  25.  
  26. }
  27. else{
  28. $sql = "INSERT INTO wiadomosci (nadawca, odbiorca, tytul, tresc, przeczytana, wlasciciel, katalog) VALUES ('$nadawca', '$odbiorca', "
  29. ."'$tytul', '$tresc', 0, '$odbiorca', 'Odebrane')";
  30. $result = $conn->query($sql);
  31. $sql = "INSERT INTO wiadomosci (nadawca, odbiorca, tytul, tresc, przeczytana, wlasciciel, katalog) VALUES ('$nadawca', '$odbiorca', "
  32. ."'$tytul', '$tresc', 0, '$nadawca', 'Wyslane')";
  33. $result = $conn->query($sql);
  34. }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement