Guest User

Untitled

a guest
Mar 25th, 2016
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. <?php
  2. $servername = "mysql.ct8.pl";
  3. $username = "m1787_kuba";
  4. $password = "$$$$$$";
  5. $db = "m1787_kuba";
  6. $msg = $_POST['msg'];
  7. $nick = $_POST['nick'];
  8. $conn = new mysqli($servername, $username, $password,$db);
  9.  
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14.  
  15. if($_SERVER['REQUEST_METHOD'] === 'POST')
  16. {
  17. if (strlen($nick) <= 1 or strlen($msg) <= 1)
  18. {
  19. header("Location: blad.php");
  20.  
  21. }
  22. else
  23. {
  24. $sql1 = "INSERT INTO adminmsg VALUES('$nick','$msg','NULL')";
  25. $conn->query($sql1);
  26. header("Location: sukces.php");
  27. }
  28.  
  29.  
  30.  
  31. exit();
  32. }
  33.  
  34.  
  35. $sql = "SELECT * FROM adminmsg";
  36.  
  37. $result = $conn->query($sql);
  38.  
  39. if ($result->num_rows > 0) {
  40. // output data of each row
  41. while($row = $result->fetch_assoc()) {
  42. echo '<table width="1000">';
  43. echo "<tr>";
  44.  
  45. echo "<p style='width:100%; height:70px; background-color:#838C8F; color:white; line-height:200%; font-size:35px; '>".$row['Wiadomosc']."&nbsp".$row['User'].'</td>'."</p>".'<a style="text-decoration: none; color:white; background:#737373; min-height:50px; padding:20px; positon:relative;
  46. width:150px;" href="usun.php?id>Usuń<a>';
  47. echo "</tr>";
  48.  
  49.  
  50.  
  51. echo "</table>";
  52. }
  53.  
  54. } else {
  55. }
  56.  
  57. $conn->close();
  58.  
  59. ?>
Add Comment
Please, Sign In to add comment