|
VB SCRIPT |
| Top 2 Resources | |
| Resource | DevGuru |
| Resource | Visual Basic Script |
| Quick Reference | |
| Code | |
| DateAdd | CalcDate = DateAdd("d", dayBreakpoint, RefDate) |
| ADO (Connection) | |
| set
conn1=Server.CreateObject("ADODB.Connection") conn1.ConnectionString="DSN=dbName;uid=userName;pwd=uerPassword" conn1.open |
|
| RecordSet Cursors | |
| set rs = conn1.execute(strSQL) | |
| set rs = Server.CreateObject("ADODB.Recordset") | |
| rs.Open strSQL, conn1, 2, 3 | |
|
Response |
response.write "Here I am!" |
|
Session |
password = session("password") |
| Login example | <% function UserAuthentication() UserAuthentication = False userid = session("userid") password = session("password") password = EncryptPassword(password) '************************************************** 'check data ' response.write userid & " user id" & "<br>" ' response.write password & " password" & "<br>" '************************************************** openDb() ChkAuthenticate() if fg_found = true then UserAuthentication = True session("manager") = mgrLevel session("fullname") = fullname session("site") = site session("department") = dept end if end function %> |
| <% ' creates a connection to the database. function openDb() set conn1=Server.CreateObject("ADODB.Connection") conn1.ConnectionString="DSN=dbName;uid=userName;pwd=userPassword" conn1.open end function %> |
|
| <% function ChkAuthenticate() set conn1=Server.CreateObject("ADODB.Connection") conn1.ConnectionString="DSN=dbName;uid=userName;pwd=userPassword" conn1.open 'USER MUST BE A MANAGER OR SUPERVISOR set rs = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT tblEmployees.emp_userID, tblEmployees.emp_password, tblEmployees.emp_full_name AS EmpName, tblEmployees.emp_department as dept, tblApplications.app_id, tblEmployeeApplications.app_level, tblEmployees.emp_site as wSite, tblLevels.lvl_description, tblEmployees.emp_first_name AS First, tblEmployees.emp_last_name AS Last " strSQL = strsQL & "FROM tblEmployees INNER JOIN (tblApplications INNER JOIN (tblEmployeeApplications INNER JOIN tblLevels ON tblEmployeeApplications.app_level = tblLevels.lvl_number) ON tblApplications.app_name = tblEmployeeApplications.app_name) ON tblEmployees.emp_userID = tblEmployeeApplications.app_userid " strSQL = strSQL & "WHERE (((tblApplications.app_id)=6))" '************************************************* ' NO USERS IN THIS SYSTEM ' MANAGERS AND SUPERVISORS '************************************************* set rs = conn1.execute(strSQL) if not rs.bof and not rs.eof then fg_found = False do while not rs.eof if ucase(rs("emp_userid")) = ucase(userid) and rs("emp_password") = password then if rs("app_level") = 0 then 'developer 'assign global variables mgrLevel = true fullname = rs("first") & " " & rs("last") site = rs("wSite") dept = rs("dept") fg_found = True exit do elseif rs("app_level") = 1 then 'manager 'assign global variables mgrLevel = true fullname = rs("first") & " " & rs("last") site = rs("wSite") dept = rs("dept") fg_found = True exit do elseif rs("app_level") = 6 then 'gatekeeper 'assign global variables mgrLevel = true fullname = rs("first") & " " & rs("last") site = rs("wSite") dept = rs("dept") fg_found = True exit do elseif rs("app_level") = 8 then 'supervisor 'assign global variables mgrLevel = False fullname = rs("first") & " " & rs("last") site = rs("wSite") dept = rs("dept") fg_found = True exit do elseif rs("app_level") = 9 then 'lead person 'assign global variables mgrLevel = False fullname = rs("first") & " " & rs("last") site = rs("wSite") dept = rs("dept") fg_found = True exit do end if end if rs.movenext loop rs.close set rs = nothing end if end function %> |
|