Advertisement
Guest User

Untitled

a guest
Jan 16th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="description" content="">
  8. <meta name="author" content="">
  9. <title><?php echo htmlspecialchars($_GET["name"]);?>@<?php echo htmlspecialchars($_GET["channel"]);?> - OtterLogs</title>
  10. <!-- Bootstrap core CSS -->
  11. <link rel="stylesheet" type="text/css" href="/bootstrap/css/bootstrap2.css"">
  12. <!-- Custom styles for this template -->
  13. <link href="/starter-template.css" rel="stylesheet" type="text/css">
  14. <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  15. <!--[if lt IE 9]>
  16. <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  17. <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
  18. <![endif]-->
  19. </head>
  20. <body>
  21. <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
  22. <div class="container">
  23. <div class="navbar-header">
  24. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
  25. <span class="sr-only">Toggle navigation</span>
  26. <span class="icon-bar"></span>
  27. <span class="icon-bar"></span>
  28. <span class="icon-bar"></span>
  29. </button>
  30. <a class="navbar-brand" href="#">OtterLogs</a>
  31. </div>
  32. <div class="collapse navbar-collapse">
  33. <ul class="nav navbar-nav">
  34. <li class="active">
  35. <a href="#">Logs</a>
  36. </li>
  37. <li style="display: block;">
  38. </li>
  39. <li style="display: block;">
  40. </li>
  41. </ul>
  42. </div>
  43. <!--/.nav-collapse -->
  44. </div>
  45. </div>
  46. <div class="container">
  47. <div class="starter-template">
  48.  
  49. <?php
  50.  
  51. error_reporting(-1); // reports all errors
  52. ini_set("display_errors", "1"); // shows all errors
  53. ini_set("log_errors", 1);
  54. ini_set("error_log", "/tmp/php-error.log");
  55.  
  56. $user = "XXXXX";
  57. $password = "XXXXX";
  58.  
  59. $db = mysqli_connect('XXXXX', $user, $password, 'XXXXX');
  60. if($db->connect_errno > 0){
  61. die('Unable to connect to database [' . $db->connect_error . ']');
  62. }
  63.  
  64. $statement = $db->prepare("SELECT Time, Message FROM Messages WHERE Sender=? AND Channel=? ORDER BY Time DESC");
  65. $name = htmlspecialchars($_GET["name"]);
  66. $channel = htmlspecialchars($_GET["channel"]);
  67. $statement->bind_param('ss', $name, $channel);
  68.  
  69. $statement->execute();
  70.  
  71. $statement->bind_result($returned_time, $returned_message);
  72.  
  73. if(is_null($statement->fetch()))
  74. {
  75. ?><h1>No records found for user <?php echo htmlspecialchars($_GET["name"]);?> on channel <?php echo htmlspecialchars($_GET["channel"]);?></h1><?php
  76. die();
  77. }
  78. else
  79. {
  80. ?>
  81. <h1>Latest messages from user <?php echo htmlspecialchars($_GET["name"]);?> on channel <?php echo htmlspecialchars($_GET["channel"]);?></h1>
  82. <br><table border="1" align="center" style="width: 80%;">
  83. <p class="lead">
  84. <thead>
  85. <tr>
  86. <th height="25" style="text-align: center;">Time</th>
  87. <th height="25" style="text-align: center;">Message</th>
  88. </tr>
  89. </thead>
  90. <tbody>
  91.  
  92. <?php
  93. while($statement->fetch()){
  94. ?>
  95. <tr>
  96. <td height="25"><?php echo $returned_time?></td>
  97. <td height="25"><?php echo $returned_message?></td>
  98. </tr>
  99. <?php
  100. }
  101. ?>
  102. </tbody>
  103. </table>
  104. <?php
  105. }
  106. $statement->free_result();
  107. ?></p>
  108. </div>
  109. </div>
  110. <!-- /.container -->
  111. <!-- Bootstrap core JavaScript
  112. ================================================== -->
  113. <!-- Placed at the end of the document so the pages load faster -->
  114. <script src="assets/js/jquery.min.js"></script>
  115. <script src="bootstrap/js/bootstrap.min.js"></script>
  116. <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  117. <script src="assets/js/ie10-viewport-bug-workaround.js"></script>
  118. </body>
  119. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement