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

Compare() not working as expected 1

Status
Not open for further replies.

DeZiner

Programmer
May 17, 2001
815
US
Hello all,

I am using compare() and checking for username and password login info. Hoping to use this to make them both a case sensitive check. The database contains a username and password both of frank for example. When the script runs though, it will only take the login if the first letter is entered with a capital. Frank and Frank. I've outputted the record that the Access DB returns and they are surely frank and frank.

Am I missing something with compare() ? If you need code please ask

DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
We'll need to see some code if we're gonna help... It could be a wide variety of things... Its not working the way you want, maybe its not written exactly the way you think it is, I'd say that's what we're all here for.

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Here is what I am using. The username and password entry in the Access database is frank and frank. This code only logs the user in when they use Frank and Frank, not all lowercase. Does Compare() to a ucase to the first letter?
<!--- Get user's details from the database --->
<cfquery name=&quot;GetUser&quot; datasource=&quot;#request.datasourcename#&quot;>
SELECT username, password, Userid
FROM Users
WHERE username='#trim(Form.name)#' and Password='#trim(Form.pswd)#'
</cfquery>


<!--- Check if we have a winner! --->
<cfif GetUser.RecordCount gt 0 AND compare(form.name, getuser.username) AND compare(form.pswd, getuser.password)>

<!--- Store the user id in session variables and cookies. --->
<cflock name=&quot;getIDLock&quot; timeout=&quot;5&quot; type=&quot;readonly&quot; throwontimeout=&quot;yes&quot;>
<cfset Session.Id = GetUser.Userid>
<cfcookie name=&quot;id&quot; value=&quot;#GetUser.Userid#&quot; expires=&quot;NEVER&quot;>
</CFLOCK>


DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
From livedocs:

[Compare] performs a case-sensitive comparison of two strings.

Return value
-1, if string1 is less than string2
0, if string1 is equal to string2
1, if string1 is greater than string2
Category

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
try:
<cfif GetUser.RecordCount gt 0
AND compare(form.name, getuser.username) eq 0
AND compare(form.pswd, getuser.password) eq 0>

thereptilian120x120.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top