Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start(); ?>
- <!DOCTYPE html>
- <html>
- <head>
- <META http-equiv="refresh" content="5;URL=chat.php">
- <style>
- /* latin */
- @font-face {
- font-family: 'VT323';
- font-style: normal;
- font-weight: 400;
- src: local('VT323'), local('VT323-Regular'), url(VT323.woff2) format('woff2');
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
- }
- *{
- font-family: 'VT323', monospace!important;
- }
- html {
- padding-bottom: 150px;
- }
- body {
- width: 65vh;
- margin: 20px auto;
- background: #222;
- color: #aaa;
- font-size: 20px;
- min-width: 820px;
- overflow-y: scroll;
- }
- .post{
- padding: 10px;
- background-color: #333;
- float:left;
- clear: both;
- width: 100%;
- }
- .message,.tripcode,.handle{
- float:left;
- }
- .handle{
- margin: 0 0px 0 0px;
- width: 25%;
- }
- .tripcode{
- color: gray;
- margin-right: 10px;
- width: 40px;
- }
- .message{
- word-break: normal;
- word-wrap: break-word;
- width: 75%;
- min-width: 400px;
- clear: none;
- float: right;
- }
- .name{
- display: inline;
- color:#999;
- clear: none;
- }
- .user{
- color:#aaa;
- }
- #shadow{
- box-shadow: inset 0px 20px 20px -10px #222;
- position: fixed;
- width: calc(65% + 20px);
- height: 30px;
- top:-2px;
- margin: 0 auto;
- pointer-events: none;
- background: none;
- }
- ::-webkit-scrollbar {
- /* This is the magic bit */
- display: none;
- }
- ::-moz-scrollbars-none{
- display: none;
- }
- </style>
- </head>
- <body>
- <!--<div id='shadow'></div>-->
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "pass";
- $dbname = "name";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT clock, tripcode, handle, message FROM posts ORDER BY id DESC";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- echo '<div class="post" title="Timestamp: '. $row["clock"] .'">';
- echo '<div class="handle"><div class="tripcode">' . $row["tripcode"]. '</div><div class="user"><<div class="name">'. $row["handle"]. '</div>></div></div><div class="message">' . $row["message"]. '</div><br>';
- echo '</div>';
- }
- } else {
- echo "0 results";
- }
- $conn->close();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment