%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Function RandomChar dim intRdm do intRdm = Int((122 - 49) * Rnd + 48) loop while intRdm > 57 And intRdm < 65 Or intRdm > 90 And intRdm < 97 RandomChar = chr(intRdm) End Function function RandomString (length) dim str, count str = "" count = 0 Do Until Count = length Count = Count + 1 str = str & RandomChar() Loop RandomString = str end function Sub SendEmail (xfrom,xto,xsubject,xtext) Set myMail=CreateObject("CDO.Message") set cdoConfig = CreateObject("CDO.Configuration") cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "relay-hosting.secureserver.net" cdoConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 cdoConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False cdoConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30 'cdoConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication 'cdoConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="web@prozakandtheplatypus.com" 'cdoConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="web4platy" cdoConfig.Fields.Update myMail.Configuration = cdoConfig myMail.Subject=xsubject myMail.From=xfrom myMail.To=xto myMail.TextBody=xtext myMail.Send set myMail=nothing set cdoConfig=nothing end sub ' Initialize some stuff dim LogonRecord, ErrorMessage, Done Randomize Timer ErrorMessage = "" Done = false ' See if we're processing a form or if we're just here the firs time... if request.form("Function") = "Login" then ' Logging in. Look for a record in the members table with the specified ' username and (encoded) password. Dim encodedpw encodedpw = PWHash(request.form("Password")) Set LogonRecord = Server.CreateObject ("ADODB.Recordset") LogonRecord.Open "Select * from Members where MemberUsername = '" & request.form("Username") & "'" _ & " and MemberPassword = '" & encodedpw & "'", MM_PlatyDB_String if LogonRecord.eof then ErrorMessage = "Invalid Username or Password; please try again" else ' Login is good! Save info in session variables, and possibly in cookies. Session("LoginID") = LogonRecord("ID") Session("LoginPassword") = encodedpw If Request.Form("SaveCredentials") then Response.Cookies("PlatyCredentials").expires = DateAdd("m", 6, Date) Response.Cookies("PlatyCredentials")("ID") = Session("LoginID") Response.Cookies("PlatyCredentials")("Password") = Session("LoginPassword") else Response.Cookies("PlatyCredentials")("ID") = -1 Response.Cookies("PlatyCredentials")("Password") = "" Response.Cookies("PlatyCredentials").expires = DateAdd("d", -1, Date) end if ErrorMessage = "G'day, mate! You're logged in.
|
|||||||||||||