Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a web site containing one form, which is submitted with a "submit" button. To check data validity, there is a JavaScript function called by the onsubmit attribute of the form.

The 'form' statement is
HTML
<form id="Form1" method="post" action="LatLong.php"  önsubmit="return(ChkSubmit());"
 target="Response">

In all tests which I have done with various browsers, this works as expected.

However, from time to time, I get spurious calls to the php file which come in groups of 5 calls spread over a few seconds. By setting the initial value of a dummy field, I have demonstrated that they do come from the form (not by direct access to the php), but the ChkSubmit() function has not been called in these cases - the first thing it does is to change the dummy value.

php always reports the HTTP_USER_AGENT as "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"

I suspect that a robot is somehow making these calls. While I can ignore them in the php file, it would be better to avoid them happening. I would appreciate any advice.

Roger
Posted

1 solution

Whatever validations you are doing in client side, that's fine. But you have to again repeat that in Server Side. That is because, if User disables the JavaScript in Browser, then client side validation would not work.

So, it might be a case that, the requests, which are doubtful, coming from a JavaScript disabled Browser.
 
Share this answer
 
Comments
Senta 15-Jun-14 13:55pm    
Thanks for the comments, Tadit Dash. I do also validate my data on the server side.

Disabled JavaScript is consistent with my dummy test field staying at its default value. However, all the user fields are also always at their default values, which seems unlikely if there is a genuine submit. It also does not explain the 5 successive submits or the user agent always being the same.

I do also get genuine submits, where the fields have been changed, and the user agent varies.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900