Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. //open the box, that surrounds the messages
  2. echo("<div class='dialogueBox'>");
  3.  
  4. while($row = mysqli_fetch_row($erg)) {
  5. //determine if the message is your own
  6. if($row[0] != $_SESSION["username"]) $ownmess = false;
  7. else $ownmess = true;
  8.  
  9. //begin div dependend on the sender of the message
  10. if($ownmess) echo ("<div class='dialogue own' >");
  11. else echo ("<div class='dialogue other'>");
  12.  
  13. //write Text
  14. echo($row[3] . "<br>");
  15.  
  16. //write the timestamp as 'little' text (write blue, if it was read and its your own message)
  17. echo("<a class='little'");
  18. if($row[4] != 0 && $ownmess) echo(" style='color:Blue;'");
  19. echo(">" . $row[2]."</a>");
  20.  
  21. //close div, and end message
  22. echo("</div> <br><br><br>");
  23.  
  24. }
  25.  
  26.  
  27. //close big div, that surrounds all messages
  28. echo("<br></div>");
  29.  
  30. .dialogueBox {
  31. width: 50%;
  32. margin-left: 25%;
  33. border: 1px solid Black;
  34. background-color: #BBAA88;
  35. max-height: 500px;
  36. overflow: auto;
  37. }
  38.  
  39. .dialogue {
  40. border: none;
  41. margin: 5px;
  42. border-radius: 5px;
  43. padding: 3px;
  44. font-size: 15;
  45. white-space: pre-wrap;
  46. }
  47.  
  48. .own {
  49. float: right;
  50. background-color: #9aaa63;
  51. }
  52.  
  53. .other {
  54. float: left;
  55. background-color: #cec178;
  56. }
  57.  
  58. .little {
  59. font-size: 10px;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement