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!

var doesn't equal var

Status
Not open for further replies.

mikecx

Technical User
Jul 9, 2002
215
US
Here's the scoop. Accroding to my code the password being sent to the next page isn't the same as the password in the database. I went in the database and checked and sure enough I used the right password. I tried creating a new account with the same problem. A friend tells me to trim the variables in order to remove spaces. That doesn't help at all. It's setup like this.

Login Page
- Username Field ( sends "User" to next page )
- Password Field ( sends "Pass" to next page )

Checking Page
- strusername = Trim(Request.Form("User"))
- strppassword = Trim(Request.Form("Pass'))

strSQL SELECT dbo.users.password FROM dbo.users WHERE dbo.users.username = '" & strusername & "'"

( Basically saying get the password for the username entered on the page before ).

Then I have it set that if there is no record with that username it goes to an error page with bad username, if strpassword <> Rs(0) then go to that page but say password is bad, and finally one to login if the password is correctly.

If you are still with me, my problem is that it keeps going to the bad password page. I commented out the bad password page and then it goes no where. I had it write out the variables and it said &quot;password&quot; = &quot;password&quot;. I am at the end of my wits with this one. Please Help!!!!
 
I guess i'm either not thinking right or out of it today. There we're 2 problems both causing it not to work. After tons of mixing around variable names I accidentally had it trying to set the username = to the password. I also had it trimming the input from the form but not the imput from the database. The database was returning the password +1 space and the form had it trimmed. It's fixed now.
 
Good work :)

Its always a good idea to use a Response.write to see what values your variables really have.

Transcend
[gorgeous]
 
You can also response.write the len() of each password as well. This will help you find those elusive spaces.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top