// Check if to reroute allways for everyone except administrator.
if (FRouteWhen=rwAllways) and (not (IsAdmin or LikeToBeAdmin)) then
begin
DoRoute(Request.UserName);
exit;
end;
// Check if not authenticated and no guest session defined, exit.
if (not Authenticated) and ((Request.UserName='') or (not Assigned(OnCreateGuestSession))) then goto L_exit;
// Check limits. Doesnt apply to the administrator.
if not IsAdmin then
begin
// Check if not accepting sessions here. Either reroute or give error.
if FMaxSessions=0 then
begin
// Check if to route.
if FRouteWhen=rwWhenFull then
DoRoute(Request.UserName)
else
Response.Response.Text:='<BODY><P><H1>Welcome</H1></P><P>'+SiteName+'('+inttostr(SiteID)+') is currently not accepting new sessions.</P><P>Please try later.</P></BODY>';
exit;
end;
// Check if full. Either reroute or give error.
if FMaxSessions>0 then
begin
c:=SessionCount;
if c>=FMaxSessions then
begin
// Check if to route.
if FRouteWhen=rwWhenFull then
DoRoute(Request.UserName)
else
Response.Response.Text:='<BODY><P><H1>Welcome</H1></P><P>'+SiteName+'('+inttostr(SiteID)+') is currently fully booked. ('+inttostr(c)+' active sessions).</P><P>Please try later.</P></BODY>';
exit;
end;
end;
// Check if to many logins from identical user.
if (FMaxIdenticalUser>0) and (CountIdenticalUser(Request.UserName)>=FMaxIdenticalUser) then
begin
Response.Response.Text:='<BODY><P><H1>Welcome</H1></P><P>'+SiteName+'('+inttostr(SiteID)+') only allow you to be logged in '+inttostr(FMaxIdenticalUser)+' times with the same username.</P><P>If you cant do a proper logout at this time then please wait another 10-20 minutes, and try to logon again.</P></BODY>';
exit;
end;
end;
EnterCriticalSection(SesMgrCSCreate);
try
// Check if to show another form if not authenticated.