How to trap a user keypress


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to trap a user keypress
# 1  
Old 08-24-2008
Question How to trap a user keypress

Yo,
I program Unix for fun- except when editing my website removed by reborg - and wanted to learn how to track, trap, and use to my advantage a user keypress. I know there is a built-in JS function that can do that, but Javascript is a client-side language, therefore not usable in Unix, and throughout my search, I have not been able to find any built in php funtion to do this- IE looking up functions on php.net/FUNTIONNAME- which is the language that I am using. How would I write this function in php?

Tanks,
SB
# 2  
Old 08-24-2008
So you want something like a keylogger through javascript? The current implementations of javascript in web browsers won't allow you by default to trap user keypresses I guess.
# 3  
Old 08-24-2008
Quote:
Originally Posted by signebedi
Yo,
I program Unix for fun- except when editing my website removed by reborg - and wanted to learn how to track, trap, and use to my advantage a user keypress. I know there is a built-in JS function that can do that, but Javascript is a client-side language, therefore not usable in Unix, and throughout my search, I have not been able to find any built in php funtion to do this- IE looking up functions on php.net/FUNTIONNAME- which is the language that I am using. How would I write this function in php?

It's not clear what you are looking for.

In what situtation do you want to trap a keypress?

If it's on a web page, then it has to be done client-side -- in the user's browser. That is best done with JavaScript.

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Simulate keypress in bash

Hello everybody, I am using Windows 10 and cygwin/bash. I need to write a script in bash which simulates opening of a program and then press some keys such as F5, ENTER and ALT+F4. I have written a VBScript which does the job Set WshShell = WScript.CreateObject("WScript.Shell")... (9 Replies)
Discussion started by: supernono06
9 Replies

2. Shell Programming and Scripting

How can i TRAP a user Logout action?

When the temp user logs in i see his session as below. # who root pts/0 2017-08-18 08:32 (121.87.51.113) temp pts/1 2017-08-18 09:06 (121.87.51.113) root pts/2 2017-08-18 08:59 (121.87.51.113) When he logs out by either firing exit command or closing the... (3 Replies)
Discussion started by: mohtashims
3 Replies

3. Homework & Coursework Questions

VM trap may work differently than a pure install trap.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: That is the last reply I received from my instructor, and I'm looking for some alternatives. When using... (2 Replies)
Discussion started by: newuser45
2 Replies

4. Shell Programming and Scripting

Trying to Bind a keypress to a function

I've been trying to re-think an old problem that didn't get answered. I know this is possible, but I'm having trouble getting it to run. I just want to call a function with a key-press or key combination. I looked and saw bind can be used to run functions and other scripts this way. Here's what... (2 Replies)
Discussion started by: Azrael
2 Replies

5. Programming

get keypress c++Qt

Hi i need to get the key pressed from the keyboard without focus on the application. i work under CentOS 5.5 with QtC++ 4.7 and Python Script (0 Replies)
Discussion started by: HanyM.Magdy
0 Replies

6. UNIX for Dummies Questions & Answers

How do i detect a keypress such as Page-Down ?

Hi, New user here, I have googled this but found nothing that helps me. I have a file of data and want to display it to a user from within a "frame/window/screen" that allows the user to pageup/pagedown through the data. I can do this mostly, but I cannot detect the pressing of the... (6 Replies)
Discussion started by: gcraill
6 Replies

7. Shell Programming and Scripting

Cntl+z Trap is not detecting ??? Help required to add a trap detection ???

Hi folks, I have tried to add some trap detection in the below script....this script is used to monitor database activities...in a rather awkward way :rolleyes:.... The idea behind adding trap is that....this script creates lots of temporary files in the running folder to store the count... (1 Reply)
Discussion started by: frozensmilz
1 Replies

8. UNIX for Dummies Questions & Answers

trap signal on user logout ?

hi all , I want to execute a script on the user logout(using gnome environment). Is ther any way to execute it through TRAP stmt? (2 Replies)
Discussion started by: harsha10
2 Replies

9. Shell Programming and Scripting

Building a better mouse trap, or How many lines of code does it take to trap a mouse?

Hello all, I'm hoping to get a little insight from some of the wily veterans amongst you. I've written a script to check for new outgoing files to our vendors located on our ssl server. It seems to be working ok, but the final question here, will be one of logic, and/or a better way to... (4 Replies)
Discussion started by: mph
4 Replies

10. Programming

keypress signals

How-to use keypress action signals in C? Is there any nice select or poll functions for that? (1 Reply)
Discussion started by: Esaia
1 Replies
Login or Register to Ask a Question