www.webdeveloper.com
Results 1 to 3 of 3

Thread: Skip the login page

  1. #1
    Join Date
    Mar 2011
    Posts
    1

    Skip the login page

    I have a website which contains link to another application. That application requires username and password for authentication.I want that when someone clicks on the link, he should be redirected to welcome page(instead login page). I will provide username and password internally,thus skipping the login page. Is there a way to do so?
    NOTE: All users will have same username & password.

  2. #2
    Join Date
    Jul 2010
    Location
    /ramdisk/
    Posts
    865
    You should explain more about the authentication and authorization mechanisms you're using. Its also hard to give you any sample code because you haven't said what language you're using.

    You might consider hard coding it into the page the link follows and then redirect them (write response headers to redirect them or output a html redirection). Before you write the headers you'll call whatever mechanism you use to authenticate them and then I assume you don't reauthenticate them for every request, so they'll be logged in until they log out or their session expires. They'll never even need to know the credentials for the account they're using.

    If they're already logged in you'll need to overwrite the username they're authenticated with, as most systems are set up to let you log in as a single user.

    There are a lot of ways to handle this situation, I can probably come up with 10 which are all fine.

  3. #3
    Join Date
    Jul 2010
    Location
    /ramdisk/
    Posts
    865
    It's really only a couple lines of code... I might as well just post it in PHP:

    PHP Code:
    <?php

    session_start
    (); 
    //you might consider changing the save path- /tmp/ is only so big and there's a lot of people on a shared host

    $_SESSION['user'] = 'The username you want them to be';

    header("Location: http://www.    whatever url you want");
    exit;

    ?>
    You might need to figure out how to bypass the authentication system- but it's usually as easy as writing user into a session. That user probably needs to exist inside the database too.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles