File: D:/web/secure/csl/bam/redirect.asp
<%Option Explicit%>
<!--#include file="dbfunctions.asp"-->
<!--#include file="commonutils.asp"-->
<html>
<body>
<%
'DebugOn ' ***
'SetDebugLevel 2 ' ***
' (SS,5/12/14) looks at the id and redirects to appropriate BAM (bam1 to bam5)
Const MAX_BAMS = 5
Dim i, LBAMID, LFound, LPos, LAdminSuffix
LBAMID = UCase(Request.QueryString("id"))
' check for /admin to go to admin section
LAdminSuffix = ""
LPos = InStr(LBAMID, "/")
If LPos > 0 Then
If LCase(Mid(LBAMID, LPos + 1)) = "admin" Then
LAdminSuffix = "/admin"
LBAMID = Left(LBAMID, LPos - 1)
End If
End If
LFound = False
If LBAMID <> "" Then
For i = 1 To 5
If GetSQLRecordExists("SELECT * FROM csl_bam" & i & ".settings WHERE BookingNoPrefix = '" & CleanSQLStr(LBAMID) & "'") Then
LFound = True
Exit For
End If
Next
End If
Finalise ' closes the database which would have opened in commonutils
If LFound Then
Response.Write "BAM found " & i & "<br>"
Response.Redirect "https://secure.itpartnership.com/bam" & i & LAdminSuffix
Else
Response.Write "BAM '" & LBAMID & "' not found"
End If
%>
</body>
</html>