Witam,

od kilku dni nie mogę dojśc jaki robie błąd...

W konsoli błędów nie pokazuje żadnych błędów...

Pokauje mi tylko Pobieranie wiadomości i to wsystko...

indeks.php

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  4. <link rel="stylesheet" type="text/css" href="style.css" />
  5. <script type="text/javascript" src="shoutbox.js"></script>
  6. <title>Untitled Document</title>
  7. </head>
  8.  
  9. <body onload="process();">
  10.  
  11. <div class="site">
  12.  
  13. <div class="logo"><div class="tekst_logo"> ShoutBox</div></div>
  14.  
  15. <div class="srodek">
  16.  
  17.  
  18. <div class="lewa_strona">
  19.  
  20. <a href="#">Strona główna</a><br />
  21. <a href="#">Panel Admina</a><br />
  22.  
  23.  
  24.  
  25.  
  26. </div>
  27.  
  28. <div class="prawa_strona">
  29. <br />
  30.  
  31. <?php require_once('shout.php');?>
  32.  
  33. <br /><br />
  34.  
  35. </div>
  36.  
  37.  
  38. </div>
  39.  
  40.  
  41. <div class="stopka">
  42.  
  43. <div class="stopka_tekst"> &copy; 2007 ShoutBox by <a href="http://spurspage.com">Snajper</a></div>
  44.  
  45. </div>
  46.  
  47. </div>
  48.  
  49. </body>
  50. </html>


shoutbox.class.php

  1. <?php
  2.  
  3. require_once('config.php');
  4.  
  5. class ShoutBox
  6. {
  7.  
  8. private $mMysqli;
  9.  
  10. function __construct()
  11. {
  12. $this->mMysqli = new mysqli($host, $user, $password, $baza);
  13. }
  14.  
  15. //funkcja główna -> ShoutBox
  16.  
  17. public function GetShoutBox()
  18. {
  19.  usleep(500000);
  20.  
  21.  $query = "SELECT * FROM sb_wpis";
  22.  
  23.  $result = $this->mMysqli->query($query);
  24.  
  25.  $dane = $result->fetch_array(MYSQLI_ASSOC);
  26.  
  27.  $result->close();
  28.  
  29.  $id = stripslashes($dane['id']);
  30.  $data = stripslashes($dane['data']);
  31.  $tresc = stripslashes($dane['tresc']);
  32.  $autor = stripslashes($dane['autor']);
  33.  
  34.  
  35.  
  36.  $wiadomosc = '['. $data .']'. $tresc .'-'. $autor.'.';
  37.  return $wiadomosc;
  38.  
  39. }
  40.  
  41. function __destruct()
  42. {
  43. $this->mMysqli->close();
  44. }
  45.  
  46.  
  47. }
  48.  
  49.  
  50. ?>


shoutbox.php

  1. <?php
  2.  
  3. require_once('shoutbox.class.php');
  4.  
  5. $action = $_GET['action'];
  6.  
  7. if($action == "ShoutBox")
  8. {
  9.  
  10. $shoutbox = new ShoutBox;
  11.  
  12. $wiadomosc = $shoutbox->GetShoutBox();
  13.  
  14. echo $wiadomosc;
  15.  
  16. }
  17.  
  18.  
  19. ?>


shoutbox.js

  1. var xmlHttp = createXMLHttp();
  2. var updateserver = 10;
  3. var errorserver = 30;
  4. var serveradres = "shoutbox.php?action=ShoutBox";
  5.  
  6. function createXMLHttp()
  7. {
  8.  
  9. var xmlHttp;
  10.  
  11. try
  12. {
  13. xmlHttp = new XMLHttpRequest();
  14. }
  15.  
  16. catch(e)
  17. {
  18. try
  19. {
  20. xmlHttp = new ActiveXObject("Microsoft.XMLHttp");
  21. }
  22. catch(e){}//ignorujemy błąd !
  23. }
  24.  
  25. //sprawdzamy czy został stworzony obiekt !
  26.  
  27. if(!xmlHttp)
  28. {
  29. alert("Błąd Serwera. Proszę spróbowa za chwilę !");
  30. }
  31. else
  32. {
  33. return xmlHttp;
  34. }
  35.  
  36. }//koniec funkcji
  37.  
  38. function wiadomosc($message)
  39. {
  40. DivTresc = document.getElementById("tresc");
  41. DivTresc.innerHTML = $message;
  42. }
  43.  
  44. function errorwiadomosc()
  45. {
  46. DivTresc = document.getElementById("tresc");
  47. DivTresc.innerHTML = "Błąd Serwera. Proszę spróbowa za chwilę !";
  48.  
  49. setTimeout("process();", errorserver * 1000);
  50. }
  51.  
  52. function process()
  53. {
  54. wiadomosc("Pobieranie wiadomości... Proszę Czekac");
  55.  
  56. try
  57. {
  58. xmlHttp.open("GET", serveradres, true);
  59. xmlHttp.onreadystatechange = ReServer;
  60. xmlHttp.send(null);
  61. }
  62.  
  63. catch(e)
  64. {
  65. errorwiadomosc();
  66. }
  67. }
  68.  
  69. function ReServer()
  70. {
  71.  
  72. if (xmlHttp.readyState == 4)
  73. {
  74.  
  75. if (xmlHttp.status == 200)
  76. {
  77. try
  78. {
  79.  
  80. GetShoutBox();
  81. }
  82. catch(e)
  83. {
  84.  
  85. errorwiadomosc();
  86. }
  87. }
  88. else
  89. {
  90.  
  91. errorwiadomosc();
  92. }
  93. }
  94. }
  95.  
  96. function GetShoutBox()
  97. {
  98.  
  99. response = xmlHttp.responseText;
  100.  
  101. try
  102. {
  103. wiadomosc(response);
  104. }
  105. catch(e)
  106. {
  107. errorwiadomosc();
  108. }
  109.  
  110. setTimeout("process();", updateserver * 1000);
  111.  
  112. }


shout.php

  1. <table class="shoutbox_table">
  2.  
  3. <tr>
  4. <td class="shoutbox_td1">ShoutBox</td>
  5. </tr>
  6.  
  7. <tr>
  8. <td class="shoutbox_td2" valign="top"><div id="tresc"></td>
  9. </tr>
  10.  
  11. <tr>
  12. <td class="shoutbox_td3">
  13.  
  14. <input type="text" class="shoutbox_wpis" />
  15. Autor: <input type="text" class="shoutbox_autor" />
  16. <input type="submit" value="Dodaj" class="sub" />
  17.  
  18. </td>
  19. </tr>
  20.