Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mouse position 1

Status
Not open for further replies.

luckylong

Programmer
Mar 9, 2005
3
RO
Hi!
How can I get the mouse position in PHP. I tried with ncurses_getyx, but it doesn't seem to be installed on the server.
I need to detect if in a window, the human operator moved the mouse or not.
What can I do?
 
Hi,

If you want to catch events in the browser, you have to use some kind of client-side coding, like javascript.

That coding, then has to pass the x and y to the php script, which then will do something with the coordinates.

However: The PHP page has to be refreshed, to do something with the values! You cant simply stream content, like in flash.

You can however use flash in cooperation with php, and as far as I can tell, it's not really too advanced for a normal programmer.

Good luck, and please post here, if you find some clever ideas, as others might need them too :)

Olav Alexander Mjelde
Admin & Webmaster
 
Yes, I thought of javascript but the client can see the code in the page and realize that I am verifying if the mouse changed the position.
I am trying to find out if a page (accesed through a form) is loaded by manual operation, normalyy, or by using an automated program.
What can be done?
 
As DaButcher says, requiring input of a code generated on the fly is the only way for you to make reasonably sure that the page is not accessed by some harvesting software.
If your info is like that you might want to consider restricting it with username and passwords.
 
Tnx DaButcher, your code solved my problem in a very resonable amount of coding. U have a star from me.
 
If you made the submit button be an image, the x & y mouse position would be automatically passed in the query string.

Code:
<form method="get" action="xy.htm">
Click on this image somewhere
<input name="i" type="image" src="myimg.jpg" />
</form>

You might try and see if this works with a POST

Clive
 
Thank you for the star, luckylong.
It's always nice to see that someone can use the code that you already helped several others with :)

It can be used for several areas, like user-registration, etc.

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top