<% option explicit %> <% response.buffer = true response.addheader "cache-control", "private" response.addheader "pragma", "no-cache" response.expiresabsolute = #January 1, 1990 00:00:01# response.expires = now() - 1 response.addheader "Cache-Control", "must-revalidate" response.addheader "Cache-Control", "no-cache" dim SESSION_ID SESSION_ID = session("user_id") if isnumeric(SESSION_ID) then SESSION_ID = clng(SESSION_ID) else SESSION_ID = 0 end if if (SESSION_ID > 0) then response.redirect "calendar.asp" end if %> Entry Page <% dim m_msg dim m_user, m_passwd dim obj_rs dim PASSWORD_LENGTH, USERNAME_LENGTH dim flg_username, username_default, REDIRECT_PAGE dim FORMAT_INTEGER, FORMAT_LONG, FORMAT_DOUBLE, FORMAT_STRING FORMAT_INTEGER = 0 FORMAT_LONG = 1 FORMAT_DOUBLE = 2 FORMAT_STRING = 3 USERNAME_LENGTH = 10 ' max 50 PASSWORD_LENGTH = 10 ' max 15 REDIRECT_PAGE = "calendar.asp" flg_username = true username_default = "username" m_user = RequestValue(request.form("user_name"), FORMAT_STRING, username_default) m_passwd = RequestValue(request.form("password"), FORMAT_STRING, "") m_msg = "" if request.form("check") = "Y" then ' validate user name and password if flg_username then if m_user = "" or m_passwd = "" then m_msg = "You must enter a user name and password." end if else if m_passwd = "" then m_msg = "You must enter a password to continue." end if end if if m_msg = "" then set obj_rs = OpenDb(m_user, m_passwd) if obj_rs.eof then m_msg = "User not on file." else if trim(obj_rs.fields("user_name")) = m_user then if trim(obj_rs.fields("password")) = m_passwd then session("user_id") = obj_rs.fields("user_id") response.redirect REDIRECT_PAGE else m_msg = "Password invalid." end if else m_msg = "User not on file." end if end if end if end if %>

About Our School Montessori Curriculum Admissions Contact Us Parent, Students and Staff

Log In:

<% if flg_username then %> <% end if %>
User Name
   
Password
   
 <%=m_msg%>

 


The Montessori School of the Mahoning Valley
2008 Lynn Avenue, Youngstown, OH 44514
P: 330.788.4622 F: 330.788.1754
Email: montessori@neo.rr.com

 

<% Public Function RequestValue(tmpString, tmpFormat, defaultValue) Dim retValue Select Case tmpFormat Case FORMAT_INTEGER If tmpString = "" Then retValue = defaultValue Else If IsNumeric(tmpString) Then retValue = CInt(tmpString) Else retValue = defaultValue End If End If Case FORMAT_STRING If tmpString = "" Then retValue = defaultValue Else retValue = Trim(tmpString) End If Case FORMAT_LONG If tmpString = "" Then retValue = defaultValue Else If IsNumeric(tmpString) Then retValue = CLng(tmpString) Else retValue = defaultValue End If End If Case FORMAT_DOUBLE If tmpString = "" Then retValue = defaultValue Else If IsNumeric(tmpString) Then retValue = CDbl(tmpString) Else retValue = defaultValue End If End If End Select RequestValue = retValue End Function function OpenDb(m_user, m_passwd) dim str_db dim rs, cmd ' strconn=strconn & "USER ID=;PASSWORD=;" str_db = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("db/password.mdb") Set rs = Server.CreateObject("ADODB.Recordset") Set cmd = Server.CreateObject("ADODB.Command") ' Init the ADO objects & the stored proc parameters cmd.ActiveConnection = str_db cmd.CommandText = "qry_login" cmd.CommandType = 4 'adCmdStoredProc cmd.Parameters.Append cmd.CreateParameter("@username",200,&H0001,USERNAME_LENGTH,m_user) set rs =cmd.Execute set cmd = nothing set OpenDb = rs end function %>