Try this Johan, this is how I am testing for three levels of user
Admin and Suppliers are in one table
Students are in another table
My login will take the user to one of two pages
The key is the p_web.Script( p_web.WindowOpen( SomePage ))
and some page can be 'blah.htm' where you want a static page to go to
or it can be 'subdomain.yoururl.com'
-------------------------------------------------------------
access:student.Open()
access:supplier.Open()
access:student.UseFile()
access:supplier.UseFile()
Loc:Login = p_web.Gsv('Loc:Login')
Loc:Password = p_web.Gsv('Loc:Password')
Stu:WebUserName =Loc:Login
Stu:WebPassword = Loc:Password
Sup:WebUserName =Loc:Login
Sup:WebPassword = Loc:Password
if Access:Supplier.Fetch(Sup:Login_K) = 0 ! Login = Stu:WebUserName, Stu:WebPassword
if Sup:LoginLevel=0; Sup:LoginLevel=5;.
p_web.SetSessionLevel(Sup:LoginLevel) !!<----- 5
p_web.ssv( 'LoginLevel', Sup:LoginLevel)
if Sup:LoginLevel=5
p_web.ssv( 'IndexTitle', 'Welcome Supplier ' & clip(Sup:Firstname) & ', '& Sup:LastName)
p_web.ssv( 'LoggedInAs', 'Supplier ' & clip(Sup:Firstname) & ', '& Sup:LastName)
ELSE
p_web.ssv( 'IndexTitle', 'Welcome Admin ' & clip(Sup:Firstname) & ', '& Sup:LastName)
p_web.ssv( 'LoggedInAs', 'Admin ' & clip(Sup:Firstname) & ', '& Sup:LastName)
END
p_web.ValidateLogin()
p_web.SetSessionValue('hash',0)
p_web.SetSessionLoggedIn(1)
if Sup:WebTheme~=''; p_web.ChangeTheme( Sup:WebTheme);.
p_web.Script( p_web.WindowOpen( SomePage )) !!<<<<<< Read this Johan
elsif Access:student.Fetch(Stu:Login_K) =0
loc:invalid = 'Loc:Login'
p_web.SetValue('retry',p_web.site.LoginPage)
p_web.DeleteCookie('loc__login')
p_web.DeleteCookie('loc__password')
p_web.SetSessionLevel(1)
p_web.ssv( 'LoginLevel',1)
p_web.ssv( 'IndexTitle', 'Welcome Student ' & clip(Stu:Firstname) & ', '& Stu:LastName)
p_web.ssv( 'LoggedInAs', 'Student ' & clip(Stu:Firstname) & ', '& Stu:LastName)
p_web.ValidateLogin()
p_web.Ssv('hash',0)
p_web.Script( p_web.WindowOpen( SomeOtherPage )) !!<<<<<< Read this Johan
p_web.SetSessionLoggedIn(1)
if Stu:WebTheme~=''; p_web.ChangeTheme( Stu:WebTheme);.
else
loc:Alert = 'Login Failed - Try Again.'
loc:invalid = 'Loc:Login'
p_web.SetSessionLevel(0) ! set the session level, and any other session variables based on the logged in user.
p_web.SetSessionValue('hash',0) ! clear the hash, so this login can't get "replayed".
p_web.ssv( 'LoggedInAs', 'Failed')
p_web.SetSessionLoggedIn(false)
End
access:student.Close()
access:supplier.Close()