<% dim ID 'put the sessionid into this variable, get it from the QS, 'if the QS isnt available we will retrieve the SessionID from 'the database & put it into this variable ID = Request.Querystring("$SESSIONID") function newsession() set conn = Server.CreateObject ("ADODB.CONNECTION") conn.Open "dsn=DSN; uid=usrid; pwd=passwd" dim usripaddr usripaddr = request.servervariables("REMOTE_ADDR") MySQL = "Execute newsession '" & usripaddr & "'" SET ORS = conn.Execute (MySQL) newsession = ORS("SESSIONID") ORS.Close set conn = nothing end function function checkqs(byVal sessionid) if sessionid = "" then set conn = server.createobject("ADODB.CONNECTION") conn.Open "dsn=DSN; uid=usrid; pwd=passwd" 'the sessionid is gone, we need to retrieve it from the DB dim ipAddr ipAddr = Request.Servervariables("REMOTE_ADDR") dim mySQL mySQL = "Execute retrieve_GUID '" & ipAddr & "'" set ors = conn.execute (mySQL) ID = ors("SESSIONID") checkqs = ID ors.close set conn = nothing Else checkqs = sessionid End If end function function input_session(byVal Sessionid, byVal Dataname, ByVal Data) sessionid = checkqs(sessionid)'verify the session is active set conn = Server.CreateObject ("ADODB.CONNECTION") conn.Open "dsn=DSN; uid=usrid; pwd=passwd" sql = "Execute sessiondata '" & Sessionid & "','" & Dataname & "','" & data & "'" conn.execute (sql) set Conn = nothing End Function Function retrieve_session(byVal Sessionid, ByVal Dataname) sessionid = checkqs(sessionid)'verify the session is active set conn = Server.createobject ("ADODB.CONNECTION") conn.Open "dsn=DSN; uid=usrid; pwd=passwd" sql = "Execute retrievesession '" & Sessionid & "','" & Dataname & "'" Set ORS = conn.execute (sql) retrieve_session = ORS("sessionvaldata") ors.close set conn = nothing End Function %>