%
Dim adConn, adCom, adRS,adRecSet, DBConn, StfRS
Dim domainName
username = Trim(request.form("txtUName"))
password = Trim(request.form("txtUPwd"))
domainName = "192.168.2.11"
err.clear
Set adConn = Server.CreateObject("ADODB.Connection")
adConn.provider ="ADsDSOObject"
adConn.properties("user id") = username
adConn.properties("password") = password
adConn.Properties("Encrypt Password") = true
adConn.Open "DS Query"
Set adCom = CreateObject("ADODB.Command")
Set adCom.ActiveConnection = adConn
adCom.CommandText = _
"select mail from 'LDAP://" & domainName & "' WHERE objectCategory='user'"
Set adRS = adCom.Execute
If err.Number = 0 Then
session("userStatus") = 1
Else
response.Redirect "Login.asp?LoginF=F"
End If
set adRecSet = server.CreateObject("ADODB.Recordset")
getemail = "select mail from 'LDAP://" & domainName & "' WHERE objectCategory='user' and sAMAccountName = '" & username & "'"
adRecSet.open getemail,adConn,3,1
if adRecSet.recordcount <> 0 then
stf_email = adRecSet("mail")
Set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.open "Provider=SQLOLEDB; Data Source = 192.168.2.66; Initial Catalog = CSPRD; User Id=HRMS_to_CS; Password=T@hrm51nt"
set StfRS = Server.CreateObject("ADODB.Recordset")
StfRecSQL = "select top 1 * from PS_N_CC_INT02_STG where HR_STATUS = 'A' and EMAIL_ADDR like '%" & Trim(stf_email) & "%' order by DATETIME_STAMP DESC"
StfRS.open StfRecSQL,DBConn,3,1
if StfRS.recordcount <> 0 then
response.Write StfRS("emplid")
Session("stf_ID") = StfRS("emplid") & "
"
'response.write (request.form("full_url"))
full_url = request.form("full_url")
reDirectURL = mid(full_url,instr(full_url,"&url")+5,len(full_url))
'response.write reDirectURL & "
"
x = reDirectURL
x = x & "&PDS_HANDLE=&func=remote-login&calling_system=" & request.Form("calling_system") & "&institute=" & request.Form("institute")
x= x & "&id="
x = x & StfRS("emplid")
x= x & "&pds_url=" & request.form("pds_url")
response.redirect x
else
response.Redirect "Login.asp?LoginF=S"
end if
StfRS.close
DBConn.close
set StfRS=nothing
set DBConn = nothing
end if
adRS.close
adConn.close
Set adRS=nothing
Set adCom=nothing
Set adConn=nothing
%>