Hi there I am trying to get my action page of the website I'm building to check to see if the form input values are empty, if they are not it will then check to see if any of the form inputs contain any SQL. I have read in some other places that you can use cfparam or cfqueryparam to stop this but I don't really know how to use them.
This is the code:
Any help would be awesome, thanks.
This is the code:
Code:
<cfif len(form.username) EQ 0 OR len(form.password) EQ 0>
<p>You did not enter a username or password</p>
<p><a href="index.cfm">Please go back and try again</a></p>
<cfelse>
<cfquery name = "login" datasource="blah">
SELECT login, password
FROM member
WHERE login = '#form.username#' AND password = '#form.password#'
</cfquery>
<cfif login.RecordCount GT 0>
<cfif '#form.username#' EQ #login.login# AND '#form.password#' EQ #login.password#>
<p> Your name is right...</p>
<cfset session.memberLogin = #form.username#>
<cfelse>
<p>Sorry incorrect username or password, please try again</p>
<cflocation url="index.cfm">
</cfif>
<cfoutput>
<cfif session.name IS "admin">
<cflocation url="index.cfm">
<cfelse>
<cflocation url="profile.cfm?un=#session.name#">
</cfif>
</cfoutput>
<cfelse>
<p>Sorry you entered an incorrect username/password</p>
<p><a href="index.cfm">Try again here!</a></p>
</cfif>
</cfif>
Comment