<% //Get connected to the database Set connection = Server.CreateObject("ADODB.Connection") connection.mode = 3 //ReadWrite Mode sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=c:/inetpub/wwwroot/rocks/_private/Quizzes.mdb" connection.Open(sConnectionString) //Check the quiz log if (Request.Cookies("QuizID") = "") then //Get the name of the user sUserName = Request.ServerVariables("AUTH_USER") if (sUserName = "") then sUserName = "Anonymous" end if //Get the current date/time stamp timestamp = Date & " " & Time //Create the SQL insert command sCommand = "insert into Log ([User],[DateTime]) values ('" _ & sUserName & "', '" & timestamp & "')" //Execute the SQL command connection.Execute(sCommand) //Check for Errors if (connection.errors.count > 0) then Response.Write("Connection error...") end if //Find out what QuizID this user is taking sCommand = "Select * from Log where " _ & "User = '" & sUserName _ & "' and DateTime = #" & timestamp & "#" rsResultSet = connection.Execute(sCommand) iQuizID = rsResultSet("QuizID") //Set the QuizID cookie Response.Cookies("QuizID") = iQuizID end if } %>