Home > Panele > Users Online (LIVE)

Users Online (LIVE)

Dodane przez: piciu
opis:
kod pokazuje Użytkowników Online (LIVE) a wraz z nimi ich statusami
Kod:
  1. add_to_head("
  2. <script>
  3. function AJAX(){
  4. try{
  5. xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
  6. return xmlHttp;
  7. }
  8. catch (e){
  9. try{
  10. xmlHttp=new ActiveXObject(\"Msxml2.XMLHTTP\"); // Internet Explorer
  11. return xmlHttp;
  12. }
  13. catch (e){
  14. try{
  15. xmlHttp=new ActiveXObject(\"Microsoft.XMLHTTP\");
  16. return xmlHttp;
  17. }
  18. catch (e){
  19. alert(\"Your browser does not support AJAX.\");
  20. return false;
  21. }
  22. }
  23. }
  24. }
  25.  
  26. // Timestamp for preventing IE caching the GET request (common function)
  27.  
  28. function fetch_unix_timestamp()
  29. {
  30. return parseInt(new Date().getTime().toString().substring(0, 10))
  31. }
  32.  
  33. function refreshdiv_onlineusers(){
  34.  
  35. var seconds = 0;
  36. var divid = \"onlineusers\";
  37. var url = \"/infusions/online_users_panel/online_users_panel_standalone.php\";
  38.  
  39. var xmlHttp_one = AJAX();
  40.  
  41. var timestamp = fetch_unix_timestamp();
  42. var nocacheurl = url+\"?t=\"+timestamp;
  43.  
  44. xmlHttp_one.onreadystatechange=function(){
  45. if(xmlHttp_one.readyState==4){
  46. document.getElementById(divid).innerHTML=xmlHttp_one.responseText;
  47. setTimeout('refreshdiv_onlineusers()',seconds*1000);
  48. }
  49. }
  50. xmlHttp_one.open(\"GET\",nocacheurl,true);
  51. xmlHttp_one.send(null);
  52. }
  53.  
  54. window.onload = function startrefresh(){
  55. setTimeout('refreshdiv_onlineusers()',seconds*1000);
  56. }
  57. </script>
  58. ");
  59. openside("Users Online (LIVE)");
  60. echo "<script type=\"text/javascript\">refreshdiv_onlineusers();</script><div id='onlineusers'></div>";
  61. closeside();

©