friendlysoviet

cfcookie_problems

May 9th, 2012
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2.  
  3. <html>
  4. <head>
  5.     <title>Subject Validation</title>
  6. </head>
  7.  
  8.  
  9.    
  10. <cfscript>
  11.     //Pulling all information from tehform on the previous page.
  12.     userSite = Form.Site; //Default will always be Rice, so we don't need to test this :D
  13.     userID = FORM.ID;
  14.     userFName = FORM.FName;
  15.     userLName = FORM.LName;
  16.     userEmail = FORM.email;
  17.     userSess = FORM.Sess_ID;
  18. </cfscript>
  19.  
  20. <!-- We should also let the user know which site is actually being matched, cause that's helpful -->
  21.  
  22. <CFQUERY DATASOURCE="tr3" NAME="qryParticipantsCheck">
  23.     SELECT *
  24.     FROM RunTR2
  25.     WHERE session = #userSess#
  26. </CFQUERY>
  27.  
  28. <cfset userSiteFirst = qryParticipantsCheck.SiteFirst>
  29. <cfset userRoundsTotal = 3>
  30. <cfset userRoundsCurrent = 1>
  31.  
  32. <cfif userSite eq "RICE">
  33.     <CFQUERY DATASOURCE="tr3" NAME="qryUserCheck">
  34.         SELECT *
  35.         FROM UsersTR2
  36.         WHERE user_id = #userID# AND session_id = #userSess#
  37.     </CFQUERY>
  38. <cfelseif userSite eq "UTD">
  39.     <cfset part = qryParticipantsCheck.participants / 2>
  40.     <cfset userID = userID + part> <!--- UTD will always be the station number + 12 [or how many ], so this will be the users ID --->
  41.     <CFQUERY DATASOURCE="tr3" NAME="qryUserCheck">
  42.         SELECT *
  43.         FROM UsersTR2
  44.         WHERE user_ID = #userID# AND session_id = #userSess#
  45.     </CFQUERY>
  46. </cfif>
  47.    
  48. <!--- Now we match up the user's entered information against the information stored on to UsersTR2 to make sure they entered everything correctly. --->
  49. <cfif qryUserCheck.RecordCount neq 1>
  50.     <cflocation url = "Login.cfm">
  51. </cfif>
  52. <!--- User Exists! Let's store cookie information and update user information to the DB :D--->
  53.  
  54. <!---UpdateDB--->
  55. <CFQUERY DATASOURCE="tr3" NAME="updateSession">
  56.     UPDATE UsersTR2
  57.     SET FNAME = "#userFName#", LNAME = "#userLName#", email = "#userEmail#"
  58.     WHERE session_id = #userSess# AND user_id = #userID#
  59. </CFQUERY>
  60.  
  61. <!--Cookies-->
  62. <cfset timer = createTimeSpan(0,3,0,0)>
  63. <cfcookie name = "user.ID" value = "#userID#" expires="#timer#">               <!-- this will expire in three hours -->
  64. <cfcookie name = "user.Site" value = "#userSite#" expires="#timer#">
  65. <cfcookie name = "user.Sess" value = "#userSess#" expires="#timer#">
  66. <cfcookie name = "user.FName" value = "#userFName#" expires="#timer#">
  67. <cfcookie name = "user.LName" value = "#userLName#" expires="#timer#">
  68. <cfcookie name = "user.Email" value = "#userEmail#" expires="#timer#">
  69. <cfcookie name = "user.SiteFirst" value = "#userSiteFirst#" expires="#timer#">
  70. <cfcookie name = "user.RoundsTotal" value = "#userRoundsTotal#" expires="#timer#">
  71. <cfcookie name = "user.RoundsCurrent" value = "#userRoundsCurrent#" expires="#timer#">
  72.  
  73. <!-- And now we send the user off to wait.cfm where they will wait --->
  74. <!-- Users will not head to choose their picture choice --->
  75.    
  76. <script type="text/javascript">
  77.     location.href='picChoice.cfm';
  78. </script>
  79. <br><br>
  80.  
  81. </body>
  82. </html>
Advertisement
Add Comment
Please, Sign In to add comment