开发者

Keystroke to be written to file

I am using JS onkeyup and onkeydown function to check the key pressed by the user. I want this information to be passed to a file in ser开发者_C百科ver. I tried inserting php file commands inbetween js but that dint work out. All my key related functions are in js.

For example, if a user presses W, i want the web program to write W/ to the file in the server.

Thank you for your help.


you can send the keystroke data from javascript to a PHP script in your server (where you'll log them in a file) using, in example, an Ajax call. The jquery library can help you in this task. Look at these tutorials on using ajax calls from jquery.

I would suggest you to buffer the keystroke data on the client and send batch of information to your PHP server script, to improve the performances of the system


You should be using the AJAX technology in order to do this. I suggest you to check the jQuery javascript library that has simple Ajax methods. The PHP file will look something like this :

//receive.php 
$key = $_POST["key"]; // sending with POST method
file_put_contents("keylogger.txt",$key,FILE_APPEND);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜