% gotome=Request.ServerVariables("script_name") sServer=Request.ServerVariables("SERVER_NAME") if instr(sServer,"games.23ae.com") then response.redirect "http://www.23ae.com/games" sDSN="DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql251.secureserver.net;DATABASE=23AEGames;USER=23AEGames;PASSWORD=pooponastick23;OPTION=3;" Session.Timeout=60 EchelonAccess=0 EchelonID=session("EchelonID") 'Get session ID data if isnumeric(EchelonID) then 'If session not null (else cint will error) if EchelonID>0 then EchelonAccess=1 'if session ID exists, log in end if 'if session ID data does not exist, EchelonAccess still =0 (no attempt) if EchelonAccess<>1 then 'Check for cookie EchelonCookieUser=Request.Cookies("GameUser") 'Get the username cookie if len(EchelonCookieUser)>0 then 'If cookie not empty (else trim will fail) aEchelonUserData=GetEchelonUser(EchelonCookieUser) 'get user info from DB if isarray(aEchelonUserData)=False then EchelonAccess=2 'username not found - do you wish to register? else 'if username found in db EchelonCookiePassword=Request.Cookies("GamePass") 'Get the password cookie too if EchelonCookiePassword=trim(aEchelonUserData(2,0)) then 'if password cookie matches database session("EchelonID")=aEchelonUserData(0,0) 'write to session EchelonAccess=1 'log in else 'if password incorrect EchelonAccess=3 'failed attempt - password reminder EchelonSuspectID=EchelonCookieUser end if end if end if 'if cookie does not exist, EchelonAccess still =0 (no attempt) end if if EchelonAccess<>1 then 'Check for login data EchelonFormUser=trim(Request.Form("GameUser")) 'Get username from form EchelonFormPassword=trim(Request.Form("GamePass")) 'Get the password data too if len(EchelonFormUser)>0 then 'If formfield not null (else trim will fail) aEchelonUserData=GetEchelonUser(EchelonFormUser) 'get user info from DB if isarray(aEchelonUserData)=False then EchelonAccess=2 'username not found - do you wish to register? EchelonFormRegister=trim(Request.Form("Register")) if EchelonFormRegister="Yes" then if len(EchelonFormPassword)<3 then EchelonAccess=4 else Set Conn = CreateObject("ADODB.Connection") sSQL = "INSERT INTO C_Users (nLevel,nDisabled,sUsername,sPassword,sDisplayName,dCreate,dMod) " 'add user to DB sSQL = sSQL & "VALUES (1,0,'"&EchelonFormUser&"','"&EchelonFormPassword&"','"&EchelonFormUser&"',Now(),Now())" Conn.Open sDSN Conn.Execute(sSQL) Conn.close aEchelonUserData=GetEchelonUser(EchelonFormUser) session("EchelonID")=aEchelonUserData(0,0) 'write to session EchelonFormRememberMe=trim(Request.Form("RememberMe")) if EchelonFormRememberMe="Yes" then Response.Cookies("GameUser")=EchelonFormUser Response.Cookies("GameUser").Expires = Date + 1000 Response.Cookies("GamePass")=EchelonFormPassword Response.Cookies("GamePass").Expires = Date + 1000 end if EchelonAccess=1 'log in firsttime=1 end if end if else 'if username found in db if EchelonFormPassword=aEchelonUserData(2,0) then 'if password from form matches database session("EchelonID")=aEchelonUserData(0,0) 'write to session EchelonFormRememberMe=trim(Request.Form("RememberMe")) if EchelonFormRememberMe="Yes" then Response.Cookies("GameUser")=EchelonFormUser Response.Cookies("GameUser").Expires = Date + 364 Response.Cookies("GamePass")=EchelonFormPassword Response.Cookies("GamePass").Expires = Date + 364 end if EchelonAccess=1 'log in else 'if password incorrect EchelonAccess=3 'failed attempt - password reminder - check for add me, say user taken EchelonSuspectID=EchelonFormUser end if end if 'if username found in db end if 'if login data does not exist, EchelonAccess still =0 (no attempt) end if function GetEchelonUser(username) sSQL="Select nID,sUsername,sPassword,nLevel,nDisabled,sEmail FROM C_Users WHERE sUsername LIKE '"&username&"'" Set rs = Server.CreateObject("ADODB.RecordSet") rs.Open sSQL, sDSN, 0, 1 'adOpenForwardOnly, adLockReadOnly if not rs.eof then aEchelonUserData = rs.GetRows rs.Close Set rs = nothing GetEchelonUser=aEchelonUserData end function function GetUserName(nID) sSQL="Select nID,sDisplayName FROM C_Users WHERE nID="&nID Set rs = Server.CreateObject("ADODB.RecordSet") rs.Open sSQL, sDSN, 0, 1 'adOpenForwardOnly, adLockReadOnly if not rs.eof then sDisplayName = rs("sDisplayName") else sDisplayName = "User Deleted" end if rs.Close Set rs = nothing GetUserName=sDisplayName end function %> <% function DiscordianizeNumber(num) if len(num)=4 then num="0"&num if len(num)=3 then num="00"&num if len(num)=2 then num="000"&num if len(num)=1 then num="0000"&num DiscordianizeNumber=num end function function DateToDiscord(passeddate,additional) 'date must be "dd/mm/yyyy" - additional: 0=just date, 1=just holyday (blank return if not), 2=both 3=just date,time aOffset = split("0 31 59 90 120 151 181 212 243 273 304 334") 'ignore leap years, since St. Tibbs Day is ignored aDMonth = split("Chaos Discord Confusion Bureaucracy Aftermath") nJulian=cint(aOffset(Month(passeddate)-1))+Day(passeddate) nDDay=nJulian MOD 73 sDMonth=aDMonth(nJulian\73) if additional=3 then aCutDate=split(passeddate) passeddate=aCutDate(0) stime=aCutDate(1) end if nDYear = Year(passeddate) + 1166 sDDate=sDMonth&" "&nDDay&", "&nDYear if additional>0 then if sDMonth="Chaos" AND nDDay=5 then sHolyday="