He estado toqueteando y ya va el login:
Código PHP:
function login()
{
var name=prompt("Inserta tu nombre:","")
if (name!=null && name!=""){
var ajax = new ajaxFunction();
ajax.open("GET",pagename+"?Login=yes&name="+name+"&"+Math.random()+"="+Math.random(),true);
ajax.onreadystatechange=function()
{
if(ajax.readyState==4) // The request is complete
{
if (ajax.status==200) // Response successfull
{
if(ajax.responseText=='false')
{
alert(name+" ya existe, elige otro nombre ;)");
}
else
{
var zitalk_name=document.getElementById('zitalk_name');
var zitalk_comment=document.getElementById('zitalk_comment');
zitalk_name.value=trim(name);
onlineUsers();
if(JQ==true)
{
$("#inputs").slideDown('slow');
$("#logout").show('slow');
$("#login").hide('slow');
}
else
{
toogle('block','inputs','logout');
toogle('none','login');
}
zitalk_comment.focus();
}
}
}
}
ajax.send(null);
}
else
{
alert("Nombre no valido");
return false;
}
}