Back to Software

Everyone's Mouse Pointer

10 Sep 2011
Progress: Completed

This is a prototype of 'Everyone's Mouse Pointer' proposed by not_only_but_also.

The prototype is here.

Being able to see the cursor of everyone who's looking at a page would make the internet far less solitary.

Unfortunately, HTTP wasn't really designed for this kind of thing, and the result is quite laggy.
A dedicated server (rather than just a PHP script) would be much faster.

A bigger problem, if this were to be integrated into a popular web page, is that everyone has different screen resolutions and font sizes.
The pointer coordinates are currently just in pixels, a percentage of the screen size might be more effective.

There's no real security either, nothing to stop someone spoofing hundreds of cursors at once.

Here's the source code to the PHP file:

if ($_GET['id']) {
  if (is_numeric($_GET['id']) and is_numeric($_GET['x']) and is_numeric($_GET['y']))
    $result=mysql_query("INSERT INTO multiMouse (id,x,y) VALUES ({$_GET['id']},{$_GET['x']},{$_GET['y']}) 
      ON DUPLICATE KEY UPDATE x={$_GET['x']}, y={$_GET['y']};");

  $result=mysql_query("SELECT * FROM multiMouse WHERE time > now() - interval 3 second");  
  while ($row=mysql_fetch_row($result)){
    echo "$c$row[0] $row[1] $row[2]"; 
    $c=",";
  }
  die();
}

mysql_query("DELETE FROM multiMouse WHERE time < now() - interval 3 second");

for ($row=$i=1;$row;$i++){
  $id=$i<300?rand(1,255):"v";
  $result=mysql_query("SELECT * FROM multiMouse WHERE id = $id");
  $row=@mysql_fetch_row($result);
}