Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //open the box, that surrounds the messages
- echo("<div class='dialogueBox'>");
- while($row = mysqli_fetch_row($erg)) {
- //determine if the message is your own
- if($row[0] != $_SESSION["username"]) $ownmess = false;
- else $ownmess = true;
- //begin div dependend on the sender of the message
- if($ownmess) echo ("<div class='dialogue own' >");
- else echo ("<div class='dialogue other'>");
- //write Text
- echo($row[3] . "<br>");
- //write the timestamp as 'little' text (write blue, if it was read and its your own message)
- echo("<a class='little'");
- if($row[4] != 0 && $ownmess) echo(" style='color:Blue;'");
- echo(">" . $row[2]."</a>");
- //close div, and end message
- echo("</div> <br><br><br>");
- }
- //close big div, that surrounds all messages
- echo("<br></div>");
- .dialogueBox {
- width: 50%;
- margin-left: 25%;
- border: 1px solid Black;
- background-color: #BBAA88;
- max-height: 500px;
- overflow: auto;
- }
- .dialogue {
- border: none;
- margin: 5px;
- border-radius: 5px;
- padding: 3px;
- font-size: 15;
- white-space: pre-wrap;
- }
- .own {
- float: right;
- background-color: #9aaa63;
- }
- .other {
- float: left;
- background-color: #cec178;
- }
- .little {
- font-size: 10px;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement