Не работает код, помогите исправить....Пожалуйста, подскажите в чем трабла....не выдает список вообще(
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest){
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject){
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}
var XMLHttpRequestObject2 = false;
if (window.XMLHttpRequest2){
XMLHttpRequestObject2 = new XMLHttpRequest();
} else if (window.ActiveXObject){
XMLHttpRequestObject2 = new ActiveXObject("Microsoft.XMLHTTP");
}
function starto(){
if(XMLHttpRequestObject2){
XMLHttpRequestObject2.open("GET", "reset.php?data=0");
XMLHttpRequestObject2.onreadystatechange = function(){
if (XMLHttpRequestObject2.readyState == 4 && XMLHttpRequestObject2.status == 200){
var kololo = XMLHttpRequestObject2.responseText;
if(kololo=="1"){
getData();
}else{
starto();
}
}
}
XMLHttpRequestObject2.send(null);
}
}
function getData(){
if(XMLHttpRequestObject){
var obj = document.getElementById('pole');
XMLHttpRequestObject.open("GET", "konekt.php");
XMLHttpRequestObject.onreadystatechange = function(){
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200){
obj.innerHTML = XMLHttpRequestObject.responseText;
starto();
}
}
XMLHttpRequestObject.send(null);
}
}
konekt.php
<?php
session_start();
header('Content-Type: text/html; charset=windows-1251');
require_once "config.php";
mysql_connect($base_name, $base_user, $base_pass);
mysql_select_db($db_name);
$mybase = mysql_query("SELECT * FROM users WHERE online='1' AND id!='".$_SESSION['id']."'");
while($db2 = mysql_fetch_assoc($mybase)) {
$player = $db2['user']." (".$db2['rate'].")<br>";
echo $player;
}
?>
reset.php
<?php
session_start();
header('Content-Type: text/html; charset=windows-1251');
require_once "config.php";
mysql_connect($base_name, $base_user, $base_pass);
mysql_select_db($db_name);
$mybase = mysql_query("SELECT * FROM users WHERE online='1'");
$db2 = mysql_num_rows($mybase);
if($_SESSION['num']!=$db2 && $_GET['data']=="0"){
$_SESSION['num'] = $db2;
$sho = "1";
}else{
$sho = "0";
}
echo $sho;
?>