The script below captures the logged in user's domain and employee number.
This can be letters followed by a backslash \
The characters after the \ is the employee number.
The following line trims the domain and \, and keeps only the employee number:
UserID = Mid(UserID,instr(UserID,"\
Unfortunately there is an exception, and I need to add an if statement.
Some employee numbers have an X letter prefix, and I need to trim the X too.
For example if the employee number is X123456 I need only 123456 returned.
i.e if the logged in user is ABC\X123456 I need to trim ABC\X and leave only 123456
This is the only exception; for all the other logins I just need to trim the domain and \
like the script below shows.
Would you please help me out with an if statement that would do that for me?
If Request.ServerVariables("LOGON_USER") = "" Then
Response.Status = "401 Access Denied"
set rs = Server.CreateObject("ADODB.recordset")
UserID = Request.ServerVariables("LOGON_USER")
UserID = Mid(UserID,instr(UserID,"\")+1)
rs.Open "exec GetEmployees'" & UserID & "'", Conn
do until rs.EOF
Emp_Id = rs("Emp_Id")
First_Name = rs("First_Name")
Last_Name = rs("Last_Name")
Set rs = Nothing
Set Conn = Nothing
Employee Number: <%=Emp_Id%>
First Name: <%=First_Name%>
Last Name: <%=Last_Name%>