Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <script>
  2. $(document).ready(function() {
  3.  
  4. var notify = function(){
  5. Notification.requestPermission(function() {
  6. var notification = new Notification("Player Control Panel", {
  7. icon: 'http://i.stack.imgur.com/dmHl0.png',
  8. body: "A uma nova denuncia de uso Hack"
  9. });
  10. notification.onclick = function() {
  11. window.open("localhost");
  12. }
  13. });
  14. }
  15.  
  16. var carrega = function() {
  17. //
  18. jQuery.ajax({
  19. type: "POST",
  20. url: "config.php",
  21. dataType: "html",
  22. data: "",
  23.  
  24. // enviado com sucesso
  25. success: function(response){
  26. if( response >= 1 ) { // TOTAL DE LINHAS DO BANCO DE DADOS
  27. notify();
  28. }
  29. },
  30. // quando houver erro
  31. error: function(){
  32. alert("Ocorreu um erro durante a requisição");
  33. }
  34. });
  35. //
  36. }
  37.  
  38. setInterval(function() {
  39. carrega();
  40. }, 1); // TEMPO DE INTERVALO ENTRE CADA REQUISIÇÃO
  41.  
  42. });
  43. </script>
  44.  
  45. <?php
  46. $servername = "";
  47. $username = "";
  48. $password = "";
  49. $dbname = "";
  50.  
  51. $conn = new mysqli($servername, $username, $password, $dbname);
  52. // Check connection
  53. if ($conn->connect_error) {
  54. die("Connection failed: " . $conn->connect_error);
  55. }
  56.  
  57. $sql = "SELECT * FROM denuncias";
  58. $result = $conn->query($sql);
  59.  
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement