<% //Get connected to the database 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") == "") { //Get the name of the user sUserName = Request.ServerVariables("AUTH_USER"); if (sUserName == "") sUserName = "Anonymous"; //Get the current date/time stamp dateNow = new Date(); iHours = dateNow.getHours(); iMinutes = dateNow.getMinutes(); iSeconds = dateNow.getSeconds(); iDayOfMonth = dateNow.getDate(); iMonth = dateNow.getMonth()+1; iYear = dateNow.getYear(); sAmPm = "AM"; if (iHours > 12) { iHours -= 12; sAmPm = "PM"; } timestamp = iMonth + "/" + iDayOfMonth + "/" + iYear + " " + iHours + ":" + iMinutes + ":" + iSeconds + " " + sAmPm; //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) Response.Write("Connection error..."); //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; } %>