Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help on Returing to original page after login

    Hello

    I use a simple login script for members which works fine. However, there are different pages from where they can launch the login process and instead of stipulating the page they alway go to after a sucessful login, I would like to send them back to the page they launched the login process from. Is that possible, I've attached a copy of the login script and the part where it redirects them to the home page instead of the page they were looking at just prior to the launch of the login process.

    'Admin and user functions
    '------------------------------------------------------------
    Const strLevel2Delete = "False" 'Allow level 2 members to delete other members?
    Const strLevel2Admin = "False" 'Allow level 2 members add/modify other members. NOTE, level 2 cannot delete members, or see there passwords. Default = True
    Const strLevel1Edit = "True" 'Allow level 1 members to modify their profile. NOTE, level 1 cannot change there login count, access levels, or anyother members. Default = True
    Const strAllowRegister = "False" 'Allow people to register? Change to to "No" if you dont want to allow registering. Default = True
    Const strAllowLogin = "False" 'Allow Login After Register? Change to to "False" if you dont want to allow login in after registering. Default = True
    Const strAllowDoubleUserNames = "False" 'Allow more than 1 users names to be the same? Change to "False" if you to allow double usernames. Default = False
    Const strAllowDoubleEmails = "False" 'Allow more then one unique email address to be the same? Change to "False" if you dont want to allow double emails for users. Default = False
    Const strRequireEmail = "True" 'Make the email address of each user required
    Const strLevel1Login = "../home/home.asp" 'Where the access level 1 (lowest member) is redirected to after login
    Const strLevel2Login = "admin_menu.asp" 'Where the access level 2 is redirected to after login
    Const strLevel3Login = "admin_menu.asp" 'Where the access level 3 (admin) is redirected to after login


    'Login pages
    '------------------------------------------------------------
    Const strLoginPage = "login.asp" 'Default Page for logging in. Default = login.asp
    Const strAuthorizedPage = "../home/home.asp" 'Authorized Page for after logging in. Default = authorised_user_page.asp
    Const strUnAuthorisedPage = "login.asp" 'Unauthorised Page for unauthorized users. Default = unauthorised_user_page.htm
    %>


    thanks

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Wrong forum, I think; this is for client-side javascript. That looks like server-side vbscript.

    Anyway, get the referrer and redirect them there. Don't use a constant as the redirect page. Change this to a variable and set it to the referrer instead, if there is one (leave a default, check request.servervariables http_referer for a value).
    Const strAuthorizedPage = "../home/home.asp" 'Authorized Page for after logging in. Default = authorised_user_page.asp

    http://www.devguru.com/technologies/...variables.html

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •