1,234
edits
Changes
→Spy on User Example
echo 'bad params';
?>
</pre>
And my client-side code:
<pre>
<script type="text/javascript">
function setup()
{
document.onmousedown = mousedown;
//~ document.onmousemove = mousemove;
document.onmouseup = mouseup;
document.oncopy = copy;
//~ document.onkeydown = keydown;
}
function mousedown(event)
{
//~ alert("down at" + event.clientX + "x" + event.clientY);
logStuff("mousedown", event.clientX + "x" + event.clientY);
}
function mousemove(event)
{
//~ alert("move to " + event.clientX + "x" + event.clientY);
logStuff("mousemove", event.clientX + "x" + event.clientY);
}
function mouseup(event)
{
//~ alert("up at" + event.clientX + "x" + event.clientY);
logStuff("mouseup", event.clientX + "x" + event.clientY);
}
function copy(event)
{
//~ alert("copied " + window.getSelection());
logStuff("copy", window.getSelection());
}
function keydown(event)
{
if(event.ctrlKey && event.keyCode == 67)
alert("ctrl+c " + window.clipboardData);
}
function logStuff(event, data)
{
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function()
{
//~ alert(xmlhttp.readyState + " " + xmlhttp.status);
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
alert(xmlhttp.responseText);
}
}
xmlhttp.open("GET", "http://www.littlesvr.ca/spy/spy.php?k=" + event + "&v=" + data);
xmlhttp.send();
//alert('sent ' + "http://www.littlesvr.ca/spy/spy.php?k=" + event + "&v=" + data)
}
</script>
</pre>