Welcome to Task Re-engineering Research on Web-based Power Scores
<%
DIM username 'user name
DIM password, password1 'user password
DIM access 'access level - functionality that may be applied to the dataset
' no entry=public; 0=view; 1=research; 2=upload; 3=admin
DIM user_email, date_time
DIM msg '-- for errors
DIM CS_1 'Connection String
DIM CN_1 'Connection to ODBC database
DIM RS_0, RS_1 'RecordSet
DIM CMD_1 'command
DIM Q_0, Q_1, Q_2 'SQL query against the db
DIM Qstring 'QueryString
DIM oMail
DIM oConf
DIM Flds
DIM SID 'session ID
DIM dtNow 'current date and time
DIM sRoot 'root of server: www.konigslow.com, its DNS, or 192.168.3.24 from inside
DIM SVG_direct 'NULL initial, 0=indirection through htmi_svg.asp, 1=direct
DIM hideClient '=TRUE; FALSE: hide client info
' Response.Buffer = FALSE
CS_1 = "DSN=power_t"
'-- ODBC - ADO setup --
Set CN_1 = Server.CreateObject("ADODB.Connection")
CN_1.ConnectionString = "DSN=power_t"
CN_1.Open
SET RS_1 = Server.CreateObject("ADODB.Recordset")
RS_1.CursorType = adOpenStatic
RS_1.LockType = adLockOptimistic
SET RS_1.ActiveConnection = CN_1
SET CMD_1 = Server.CreateObject("ADODB.Command")
SET CMD_1.ActiveConnection = CN_1
CMD_1.CommandType = adCmdText
'-- email setup --
Set oMail = Server.CreateObject("CDO.Message")
Set oConf = CreateObject("CDO.Configuration")
Set Flds = oConf.Fields
Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
' **** Path below may need to be changed if it is not correct
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
Flds.Update
Set oMail.Configuration = oConf
Qstring = Trim(Request.QueryString("submitted"))
' Response.Write "Qstring: " & Qstring & " "
IF Qstring = "true" THEN
username = LCase(Trim(Request.Form("UserName")))
user_email = username
username = Replace(username,"-","___")
username = Replace(username,"@","__")
username = Replace(username,".","_")
password = Trim(Request.Form("Password"))
Q_1 = "SELECT * FROM user_dataset WHERE username='" & username _
& "' AND password='" & password & "'"
CMD_1.CommandText = Q_1
SET RS_1 = CMD_1.Execute
IF RS_1.EOF THEN
msg = "** The email address or the password is incorrect, please re-enter. **"
END IF
IF Len(msg) > 0 THEN 'user did not fill out the form properly, resubmit it
IF user_email <> username THEN
RS_1.Close
Q_2 = "SELECT * FROM user_dataset WHERE username='" & username & "'"
CMD_1.CommandText = Q_2
SET RS_1 = CMD_1.Execute
IF NOT RS_1.EOF THEN
' password1 = RS_1.Fields("password")
msg = msg & " -- Click to have the password sent to the email address. --"
END IF
END IF
username = user_email
ELSE 'user did fill out the form properly
access = RS_1.Fields("access")
dtNow = Now
Q_0 = "SELECT * FROM Design"
' Response.Write Q_0 & " "
SET RS_0 = Server.CreateObject("ADODB.Recordset")
RS_0.Open Q_0, CS_1, adOpenKeySet, adLockPessimistic, adCmdText
RS_0.AddNew
RS_0.Fields("date_time")=dtNow
RS_0.Fields("username")=username
RS_0.Fields("access")=access
sRoot = Request.ServerVariables("HTTP_HOST")
RS_0.Fields("root") = sRoot
RS_0.Fields("visitor") = Request.ServerVariables("REMOTE_HOST")
IF InStr( 1, sRoot, "192.168.3", vbTextCompare) > 0 THEN
SVG_direct = 1
hideClient = TRUE
ELSEIF InStr( 1, sRoot, "192.168.1", vbTextCompare) > 0 THEN
SVG_direct = 1
hideClient = TRUE
ELSE
SVG_direct = NULL
hideClient = FALSE
END IF
RS_0.Fields("SVG_direct")=SVG_direct
RS_0.Fields("hideClient") = hideClient
RS_0.Update
RS_0.Close
Q_0 = "SELECT * FROM Design WHERE date_time=#" & dtNow & "# AND username='" & username & "'"
' Response.Write Q_0 & " "
SET RS_0 = Server.CreateObject("ADODB.Recordset")
RS_0.Open Q_0, CS_1, adOpenKeySet, adLockPessimistic, adCmdText
SID = RS_0.Fields("SID")
Response.Cookies("Power_clientCR")("SID")=SID
date_time = WeekdayName(Weekday(Date)) & ", " & Date & " at " & Time
' -- specific email --
oMail.To = "drrainer@gmail.com"
' oMail.CC = "drrainer@gmail.com"
oMail.Subject = "Power: client usage notice"
oMail.From = "drrainer@gmail.com"
' -- we are sending a text email.. simply switch the comments around to send an html email instead
' oMail.HTMLBody = "this is the body"
oMail.TextBody = user_email & " has logged into power: " & date_time & "."
oMail.Send
' -- email reset --
Set oMail = Nothing
' ---------
' Response.Cookies("Power_clientCR")("user_email")=user_email
' Response.Cookies("Power_clientCR")("date_time")=date_time
Response.Redirect("screen.asp")
Response.End
END IF
ELSEIF Len(Qstring) > 0 THEN
user_email = Qstring
username = Replace(user_email,"@","__")
username = Replace(username,".","_")
username = Replace(username,"-","___")
Q_2 = "SELECT * FROM user_dataset WHERE username='" & username & "'"
CMD_1.CommandText = Q_2
SET RS_1 = CMD_1.Execute
IF NOT RS_1.EOF THEN
password1 = RS_1.Fields("password")
END IF
IF Len(user_email) > 0 THEN
oMail.To = user_email
oMail.Subject = "Power_client password"
oMail.From = "drrainer@gmail.com"
oMail.TextBody = "The password for " & user_email & " is: " & password1
oMail.Send
' -- email reset --
Set oMail = Nothing
END IF
' Response.Write "user_email: " & user_email & " "
msg = "** The password was sent to your email, please re-enter it in the form. **"
username = user_email
END IF
%>
In Toronto it is <%=WeekdayName(Weekday(Date)) %>,
<%= Date %> at <%=Time %>.
Rainer von Königslöw can be reached at (416) 489-2222,
or drrainer@gmail.com see notice and disclaimer.