SHARE
TWEET

Untitled

a guest May 23rd, 2018 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2.     <html>
  3.     <head>
  4.         <meta charset="UTF-8" />
  5.         <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6.         <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  7.         <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  8.     </head>
  9.     <body>
  10.  
  11. <!-- New Posts -->
  12.     <div id="newposts"></div>
  13.  
  14.     </body>
  15.     </html>
  16.    
  17. <script language="javascript">
  18.     var env = findBootstrapEnvironment();
  19.  
  20. var audioElement = new Audio();
  21.  
  22.  
  23. function playAlert(ignore_checked) {
  24.     if (ignore_checked || (document.getElementById('play_sound') && document.getElementById('play_sound').checked)) {
  25.         if (!document.contains(audioElement)) {
  26.             document.body.appendChild(audioElement);
  27.         }
  28.  
  29.         if (audioElement.canPlayType("audio/mp3")) {
  30.             audioElement.src = 'notify.mp3';
  31.         } else if (audioElement.canPlayType("audio/wav") || audioElement.canPlayType("audio/x-wav")) {
  32.             audioElement.src = 'notify.wav';
  33.         }
  34.  
  35.         if (audioElement.currentTime) {
  36.             audioElement.currentTime = 0;
  37.         }
  38.  
  39.         audioElement.play();
  40.     }
  41. }
  42.  
  43.  
  44.     function updateHistory() {
  45.         var datastring = '';
  46.         jQuery.ajax({
  47.             type: 'GET', url: 'connect.php', data: datastring,
  48.             success: function (server_response) {
  49.                 if (server_response != '1') {
  50.                     $('#newposts').html(server_response);
  51.                     if (server_response.length = 0)    return;
  52.  
  53.                     document.getElementById('updatewarning').innerHTML = '<p><strong>There have been updates to this page.</strong> Please view the updates.</p>';
  54.                     document.getElementById('updatewarning').style.display = 'block';
  55.  
  56.                     var title = document.title;
  57.                     title = title.replace("UPDATED - ", "");
  58.                     document.title = "UPDATED - " + title;
  59.                     playAlert();
  60.                 }
  61.             }
  62.         });
  63.  
  64.         setTimeout("updateHistory()", 20000);
  65.     }
  66.  
  67. updateHistory();
  68.  
  69.  
  70.     function findBootstrapEnvironment() {
  71.         var envs = ['xs', 'sm', 'md', 'lg'];
  72.  
  73.         var $el = $('<div>');
  74.         $el.appendTo($('body'));
  75.  
  76.         for (var i = envs.length - 1; i >= 0; i--) {
  77.             var env = envs[i];
  78.  
  79.             $el.addClass('hidden-'+env);
  80.             if ($el.is(':hidden')) {
  81.                 $el.remove();
  82.                 return env;
  83.             }
  84.         }
  85.     }
  86. </script>
  87.    
  88. <?php
  89. $host="localhost";  //Mysql Database Host Address
  90. $username="root";       //Database Username
  91. $pass="";           //Database Password
  92. $dataname="testdb";     //Database Name
  93.  
  94. $connect = mysqli_connect($host, $username, $pass)
  95. or die("Could not connect: " . mysql_error());
  96. mysqli_select_db($connect, $dataname) or die(mysqli_error($con));
  97.  
  98. $sql = "SELECT * FROM events ORDER BY id DESC";
  99.  
  100. $result = mysqli_query($connect, $sql);
  101.  
  102.  print "
  103. <div><ul>";
  104.  
  105.         while($row = mysqli_fetch_array($result))
  106.         {
  107.             echo "<li><span>" . $row['time'] . "</span></li>"; // Things that you want to fetch
  108.         }
  109.  
  110.  echo "
  111. </ul></div>";
  112.  
  113.  ?>
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