|
-
Feb 21st, 2001, 04:15 PM
#1
Thread Starter
PowerPoster
Hello all. I need help. Here I am querying my DB and assigning the variables to the field I am joining it to.
Then I am passing the values of the variables and assigning it to the session. Then finally I am plugging in the session values into the cookie I just created.
Problem: The cookie gets created with the correct fields but not with the values passed down from the variables.
What am I doing wrong here?
If Request.Form("txtName") <> "" Then
SQL = "Select * FROM Register WHERE " & "Register.userID='" & strUserID & _
"' AND Register.password ='" & strPassword & _
"' OR Register.FirstName ='" & strFirstName & _
"' OR Register.LastName ='" & strLastName & _
"' OR Register.Address ='" & strAddress & _
"' OR Register.State ='" & strState & _
"' OR Register.ZipCode ='" & strZipCode & _
"' OR Register.PhoneNumber ='" & strPhoneNumber & _
"' OR Register.Email ='" & strEmail & "'"
cmdDC.CommandText = SQL
Set RecordSet = Server.CreateObject("ADODB.Recordset")
RecordSet.Open cmdDC, , 3, 3
'-- If there is no record found skip this section and display current error page
If Recordset.EOF Then
Else
Session("NewUserID") = strUserID
Session("Password") = strPassword
Session("FirstName") = strFirstName
Session("LastName") = strLastName
Session("Address") = strAddress
Session("State") = strState
Session("ZipCode") = strZipCode
Session("PhoneNumber") = strPhoneNumber
Session("Email") = strEmail
Response.Cookies("ReclaimAmerica").Expires = Date+365
Response.Cookies("ReclaimAmerica").Secure = FALSE
Response.Cookies("ReclaimAmerica")("UserID") = Session("NewUserID")
Response.Cookies("ReclaimAmerica")("Password") = Session("Password")
Response.Cookies("ReclaimAmerica")("FirstName") = Session("FirstName")
Response.Cookies("ReclaimAmerica")("LastName") = Session("LastName")
Response.Cookies("ReclaimAmerica")("Address") = Session("Address")
Response.Cookies("ReclaimAmerica")("State") = Session("State")
Response.Cookies("ReclaimAmerica")("ZipCode") = Session("ZipCode")
Response.Cookies("ReclaimAmerica")("Phone") = Session("Phone")
Response.Cookies("ReclaimAmerica")("Email") = Session("Email")
Response.Clear
Response.Redirect "welcome.asp"
Response.End
-
Feb 22nd, 2001, 08:54 AM
#2
Thread Starter
PowerPoster
-
Feb 22nd, 2001, 09:11 AM
#3
Fanatic Member
Not clear on you problem!
I don't understand the question!
If you are putting a variable into a cookie then you can do it direct:
Code:
Response.Cookies("ReclaimAmerica")("UserID") = strUserID
This would be quicker than retrieving it from the session variable first.
Secondly, why are you using session variables when the same values are in the cookie?
If you are woried about client side cookies being disabled, don't use them in the first place!
-
Feb 22nd, 2001, 09:12 AM
#4
Thread Starter
PowerPoster
Thanks for the response. What I am trying to do is retreive the users information from the database and create a cookie with that info.
-
Feb 22nd, 2001, 09:24 AM
#5
Thread Starter
PowerPoster
If the user loses the cookie I have a log in page where they should just log in and then I read the database and then create a new cookie with their personalized info..
I am trying to use this code to read the DB and assign the values to the variables so I can then create a cookie with the variables:
If Request.Form("txtName") <> "" Then
SQL = "Select * FROM Register WHERE " & "Register.userID='" & strUserID & _
"' AND Register.password ='" & strPassword & _
"' OR Register.FirstName ='" & strFirstName & _
"' OR Register.LastName ='" & strLastName & _
"' OR Register.Address ='" & strAddress & _
"' OR Register.State ='" & strState & _
"' OR Register.ZipCode ='" & strZipCode & _
"' OR Register.PhoneNumber ='" & strPhoneNumber & _
"' OR Register.Email ='" & strEmail & "'"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|