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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password Containing Hash

Status
Not open for further replies.

tempoman

Programmer
May 9, 2000
41
0
0
AU
I am having trouble with user passwords containing Hash e.g. Son#1 and comparing with those in a database. It seems to only compare Son as it sees the next hash as end of the string.

<cfquery name=&quot;username_query&quot; datasource=&quot;nitrogen&quot;>
Select *
From User
Where UserName Like '#UserName#' and Password Like '#Evaluate(&quot;Password&quot;)#'
</cfquery>

Is there a way to compare the whole password?

Thanx

Richard
 
try the following code by entering the password containing # sign; the trick is to escape the # signs by duplicating them...

aside that, you might want to consider to eliminate the # signs in your forms (make it special character and make user enter password without a # sign); it will probably make your life easier in the future.

<form action=&quot;test.cfm&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;>
<input type=&quot;text&quot; name=&quot;pass&quot;>
<input type=&quot;submit&quot;>
</form>

<cfif IsDefined(&quot;Form.pass&quot;)>
<cfset Form.pass = Replace(Form.pass, &quot;Chr(035)&quot;, &quot;##&quot;, &quot;all&quot;)>

<cfquery name=&quot;username_query&quot; datasource=&quot;nitrogen&quot;>
Select *
From User
Where Password Like '#Form.pass#'
</cfquery>

<cfoutput>#qry_TextData.RecordCount#</cfoutput>
</cfif> Sylvano
dsylvano@hotmail.com
 
Is there a reason why you are Evaluating the password? I use hashes in my passwords all the time and never have a problem. The Evaluate() command tries to evaluate the contents of the variable, so that would definitely cause an error if you tried to evaluate (execute) a string with the # sign in it....

MG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top