Reputation: 235
A few days ago i've made a little Coldfusion 9 script, but somehow after submitting the form the query won't run in Firefox. Everything works well in Google Chrome, but not in Firefox.
I've tried to Google it, but i can't find anything that relates to this problem. If something is unclear for you after reading this - just ask and i'll try to explain it better to you.
The script can be found on: http://pastebin.com/Bic28B3L
Kind regards,
Upvotes: 0
Views: 871
Reputation: 1490
Looking at your code, you may also want to look at the cfqueryparam tag to help protect against sql injections and you may want to do your calculations outside the cfquery rather than in it... for example:
<cfquery name = "pay" datasource = "#DSN#">
UPDATE users
SET bots=#user.bots#-1
WHERE id=#user.id#
</cfquery>
may be better like this:
<Cfset xBots=user.bots-1>
<cfquery name = "pay" datasource = "#DSN#">
UPDATE users
SET bots=<cfqueryparam cfsqltype="cf_sql_integer" value="#xBots#">
WHERE id=<cfqueryparam cfsqltype="cf_sql_integer" value="#user.id#">
</cfquery
Upvotes: 1
Reputation: 15587
You can leave your script as it is and replace
<cfif IsDefined('form.submit')>
with
<cfif CGI.REQUEST_METHOD IS "POST">
to check if the form was submitted.
Upvotes: 1
Reputation: 1755
The culprit is two-folds:
<cfinput type='image'...>
And
<cfif IsDefined('form.submit')>
Coldfusion will generate the HTML for your CFINPUT like this:
<input type="image"...
And Firefox will generate a form post like this:
submit.x: mouseclick x coords.
submit.y: mouseclick y coords.
Firefox will not return the name of the image in the form post. It will only return the X and Y values of the image map. What you will probably have to do is replace the <CFINPUT>
TAG with an HTML <INPUT type="submit">
button and use CSS to apply an image to it. You may even consider checking for some other form variable in lieu of the submit button.
Upvotes: 1
Reputation: 5678
My guess would be that FF and Chrome are handling the form element generated by this line differently:
<cfinput type='image' src='http://linehotel.org/c_images/bot_buy.png' name='submit' value='Koop deze badge nu'>
it looks like your code is checking that form.submit exists, so I would look at the source that this tag generates.
The other thing to try would be to install and run Fiddler and use it capture the submissions made by Chrome and FF and compare the two, particularly look at the WebForms tab on the request section. There'll be a difference there if it's browser-related.
Upvotes: 1