%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' login
if request.form("action") = "login" then
strPassword = SecureFormatSQL(request.form("pwd"), 0)
'response.write(strPassword)
dim conn, rsLogin
set conn = server.CreateObject("ADODB.Connection")
conn.connectionstring = DB_CONN_STRING
conn.open
strSQL = "SELECT * FROM tblManagerLogin WHERE UserName = '" & request.form("usr") & "' AND Password = '" & strPassword & "'"
set rsLogin = conn.execute(strSQL)
if (not rsLogin.BOF and not rsLogin.EOF) then
if rsLogin("AuthLevel") > 0 then
session("svMgrInitials") = rsLogin("Initials")
session("svMgrUserName") = rsLogin("RealName")
session("svAccessLevel") = rsLogin("AuthLevel")
session("svNumRecords") = rsLogin("NumRecords")
session("svManagerID") = rsLogin("LoginID")
Session("svPastEvents") = rsLogin("PastEvents")
Session("svDelegateAttendance") = rsLogin("DelegateAttendance")
session.timeout = 30
if request.form("referrer") <> "" then
redirectStr = request.form("referrer")
end if
' CHECK CLIENT CALL BACKS AND SEND OUT ANY EMAILS IF DATE IS TODAY.
strSQL = "SELECT tblClients.*,tblManagerLogin.user_email FROM tblClients " & _
" LEFT JOIN tblManagerLogin ON tblClients.modified_by_user_id = tblManagerLogin.LoginID WHERE callback_date = '" & Date() & "' and flg_CallBack_Alerted = 0"
set rsCallBacks = conn.execute(strSQL)
'On Error Resume Next
Do While Not rsCallBacks.EOF
set objCDONT = Server.CreateObject("CDONTS.NewMail")
objCDONT.To = rsCallBacks("user_email")
objCDONT.From = "alarm@lindsay-gale.com"
objCDONT.BodyFormat = 0
objCDONT.MailFormat = 0
objCDONT.Cc = ""
objCDONT.BCc = ""
objCDONT.Subject = "Client Call Back - " & Date()
objCDONT.Body = "You have a new client (" & rsCallBacks("company_name") & ") call back for today - Click here to open: Open Call Back"
objCDONT.Send
set objCDONT = NOTHING
rsCallBacks.MoveNext
Loop
ExecuteSQL("update tblClients set flg_CallBack_Alerted = 1 where pk_clientid in (select pk_clientid from tblclients WHERE callback_date = '" & Date() & "')")
Set rsCallBacks = NOTHING
If IsNumeric(Request.form("cid")) Then
Response.Redirect("clients_add_edit.asp?action=edit&id=" & Trim(Request.form("cid")))
Response.End
Else
redirectStr = "home.asp"
End If
end if
else
redirectStr = "login.asp?err=2&cid=" & Trim(Request.form("cid"))
end if
conn.close
if redirectStr <> "" then response.redirect(redirectStr)
end if
%>
<%=MANAGER_TITLE%>
<%=getTodaysDate()%>
Log In
<% if request.QueryString("err") = "2" then %>
Either your username
and/or password was not recognised
<% elseif request.QueryString("err") = "4" then %>
<%
if inStr(request.ServerVariables("HTTP_REFERER"),"/manager/") then session("svReferer") = request.ServerVariables("HTTP_REFERER")
%>
Either your session
has timed out or you are not authorised to access that
page