SHARE
TWEET

Untitled

a guest Oct 10th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. include_once 'db.php';
  3. $page = $_GET['pg'];
  4. ?>
  5. <div class="row">
  6.   <div class="col-sm">
  7.   <div class="row">
  8.     <div class="col-sm-8">
  9.   New posts
  10.   <button class="btn btn-primary btn-outline-primary" id="reloadmsg" value="Reload" class="">Reload</button>
  11.   </div>
  12.   <div class="col-sm-4">
  13. </div>
  14. </div>
  15.     <hr class="my-4">
  16.     <div id="msgs">
  17. <script>
  18. $("#reloadmsg").click(function () {
  19.   $("#msgs").load(location.href+" #msgs>*","");
  20. });
  21. </script>
  22. <script>
  23. (function() {
  24.   'use strict';
  25.   window.addEventListener('load', function() {
  26.     var forms = document.getElementsByClassName('needs-validation');
  27.     var validation = Array.prototype.filter.call(forms, function(form) {
  28.       form.addEventListener('submit', function(event) {
  29.         if (form.checkValidity() === false) {
  30.           event.preventDefault();
  31.           event.stopPropagation();
  32.         }
  33.         form.classList.add('was-validated');
  34.       }, false);
  35.     });
  36.   }, false);
  37. })();
  38. </script>
  39. <?php
  40. $query6 = sprintf("Redacted for security");
  41. $result6 = mysqli_query($conn, $query6);
  42. $total = mysqli_num_rows($result6);
  43. $pages = ceil($total/20);
  44. $targetpage = "messages.php"; //your file name
  45. $limit = 20; //how many items to show per page
  46. if ($page <= 0) {  $page = 1; }
  47. if ($page >= $pages) { $page = $pages; }
  48. $offset = $page * 20 - 20;
  49. $prev = $page - 1;
  50. $next = $page + 1;
  51. $next2 = $page + 2;
  52. $next3 = $page + 3;
  53. $prev2 = $page - 2;
  54. $prev3 = $page - 3;
  55. if ($prev < 1) {$noprev = true; } else { $noprev = false;}
  56. if ($next > $pages) {$nonext = true; } else { $nonext = false;}
  57. $query = sprintf(Redacted for security);
  58. $result = mysqli_query($conn, $query);
  59. if (!$result) { echo "No results found for $search in your message history"; die(); }
  60. while ($row = $result->fetch_assoc()) {
  61.   $title = $row['title'];
  62.   $time = gmdate("Y-m-d h:iA", $row['time']);
  63.   $thread = $row['thread'];
  64.   $sender = $row['sender'];
  65.   $body = $row['body'];
  66.   $type = $row['type'];
  67.   $uni = $row['uni'];
  68.   if ($type == "text"){
  69.   echo "<div class=\"card\">
  70.          <div class=\"card-body\">
  71.            <h5 class=\"card-title\"><a href=\"Redacted for security">$title</a></h5>
  72.             <h6 class=\"card-subtitle mb-2 text-muted\">";echo "$sender - $time </h6>
  73.            <p class=\"card-text\">$body</p>
  74.          </div>
  75.        </div>";
  76.   } elseif ($type == "image") {
  77.   echo "<div class=\"card\">
  78.          <div class=\"card-body\">
  79.            <h5 class=\"card-title\"><a href=\"Redacted for security">$title</a></h5>
  80.             <h6 class=\"card-subtitle mb-2 text-muted\">";echo "$sender - $time </h6>
  81.            <img src=\"Redacted for security" alt=\"$title\" style=\"max-height: 200px; max-width: 600;\"\">
  82.          </div>
  83.        </div>";
  84.   } elseif ($type == "video"){
  85.   echo "<div class=\"card\">
  86.          <div class=\"card-body\">
  87.            <h5 class=\"card-title\"><a href=\"Redacted for security">$title</a></h5>
  88.             <h6 class=\"card-subtitle mb-2 text-muted\">";echo "$sender - $time </h6>
  89.            <a href=\"Redacted for security"><img src=\"Redacted for security" alt=\"$title\" style=\"max-height: 200px; max-width: 600;\"\"></a>
  90.          </div>
  91.        </div>";
  92.   }
  93. }
  94. ?>
  95. <hr class="my-4">
  96. <nav aria-label="Page navigation example">
  97.   <ul class="pagination">
  98.     <?php
  99.     if ($noprev == true) {
  100.     echo "<li class=\"page-item disabled\">";
  101.     echo "<a class=\"page-link\" href=\"?pg=1$filter\">First</a>";
  102.     echo "</li>";
  103.     echo "<li class=\"page-item disabled\">";
  104.     echo "<a class=\"page-link\" href=\"\">Previous</a>";
  105.     echo "</li>";
  106.     } else {
  107.     echo "<a class=\"page-link\" href=\"?pg=1$filter\">First</a>";
  108.     echo "<li class=\"page-item \"><a class=\"page-link\" href=\"?pg=$prev$filter\">Previous</a></li>";
  109.     }
  110.     if ($prev3 >= 1) {
  111.     echo "<li class=\"page-item\"><a class=\"page-link\" href=\"?pg=$prev3$filter\">$prev3</a></li>";
  112.     }
  113.     if ($prev2 >= 1) {
  114.     echo "<li class=\"page-item\"><a class=\"page-link\" href=\"?pg=$prev2$filter\">$prev2</a></li>";
  115.     }
  116.     if ($prev >= 1) {
  117.     echo "<li class=\"page-item\"><a class=\"page-link\" href=\"?pg=$prev$filter\">$prev</a></li>";
  118.     }
  119.     echo "<li class=\"page-item active\"><a class=\"page-link\" href=\"?pg=$page\">$page</a></li>";
  120.     if ($next <= $pages) {
  121.     echo "<li class=\"page-item\"><a class=\"page-link\" href=\"?pg=$next$filter\">$next</a></li>";
  122.     }
  123.     if ($next2 <= $pages) {
  124.     echo "<li class=\"page-item\"><a class=\"page-link\" href=\"?pg=$next2$filter\">$next2</a></li>";
  125.     }
  126.     if ($next3 <= $pages) {
  127.     echo "<li class=\"page-item\"><a class=\"page-link\" href=\"?pg=$next3$filter\">$next3</a></li>";
  128.     }
  129.     if ($nonext == true) {
  130.     echo "<li class=\"page-item disabled\">";
  131.     echo "<a class=\"page-link\" href=\"\">Next</a>";
  132.     echo "</li>";
  133.     echo "<li class=\"page-item disabled\">";
  134.     echo "<a class=\"page-link\" href=\"?pg=$pages$filter\">Last</a>";
  135.     echo "</li>";
  136.     } else {
  137.     echo "<li class=\"page-item\"><a class=\"page-link\" href=\"?pg=$next$filter\">Next</a></li>";
  138.     echo "<a class=\"page-link\" href=\"?pg=$pages$filter\">Last</a>";
  139.     }
  140.     ?>
  141.   </ul>
  142. </nav>
  143.       </div>
  144.     </div>
  145. </div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top