% 'check user information dim uidSubscriberID dim bAnonymous bAnonymous= true 'FISRTLY 'see if user has clicked from emailed newsletter if (request.querystring("sid")<>"") then 'yes they have, check if it is a valid userid if (validateUser(request.querystring("sid"))=false) then response.Redirect("error.asp?err=badid") end if 'set the session Session("uidSubscriberID") = uidSubscriberID 'try and add a cookie to their machine response.Cookies("ServoUser")=uidSubscriberID response.Cookies("ServoUser").expires=DateAdd("yyyy",10,now()) 'SECONDLY 'see if user has a session ID elseif (session("uidSubscriberID")<>"") then 'yes they have, check if it is a valid userid if (validateUser(session("uidSubscriberID"))=false) then response.Redirect("error.asp?err=badid") end if 'THIRDLY 'see if the user has a userid querystring elseif (request.QueryString("uid")<>"") then 'yes they have, check if it is a valid userid if (validateUser(request.QueryString("uid"))=false) then response.Redirect("error.asp?err=badid") end if 'FOURTHLY 'see if the user has a cookie elseif request.Cookies("ServoUser")<>"" then if (validateUser(request.Cookies("ServoUser"))=false) then 'delete the cookie as it has an invalid userid response.Cookies("ServoUser").expires=now() response.Redirect("error.asp?err=badid") end if 'set the session Session("uidSubscriberID") = uidSubscriberID 'FITHLY 'must be an anonymous browser from web site or someone who has disabled cookies else bAnonymous=true end if function validateUser(uidUser) dim sSQL dim rs dim rsDetails sSQL= "SELECT useruid FROM tRegisteredUsers WHERE useruid='" & uidUser & "'" set rs= objConn.Execute(sSQL) if not rs.EOF then uidSubscriberID = rs.Fields("useruid") bAnonymous=false validateUser=true else validateUser=false end if rs.close set rs=nothing end function %>