Advanced Search

Results 1 to 6 of 6

Thread: Login/Password redirect based on username

  1. #1
    Join Date
    Nov 2007
    Posts
    35
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Login/Password redirect based on username

    I'd like to have a password protected area of my site with one login button. when a user logs in they would be directed to the directory that corresponds with the user name.

    So if user "a" logs in they would go to one directory, but user "b" would go to another and user "c" another.

    Does that make sense? Does anyone have any experience with any particular script that they could recommend? Thanks!
    Last edited by lrickyutah; 03-12-2009 at 03:01 AM.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Is each user going to have an actual directory on your site?

  3. #3
    Join Date
    Jan 2008
    Posts
    4,158
    Thanks
    28
    Thanked 623 Times in 619 Posts
    Blog Entries
    1

    Default

    Lucky for you, I've recently - just yesterday - created a script like this.
    http://www.dynamicdrive.com/forums/s...d.php?p=188727
    Jeremy | jfein.net

  4. #4
    Join Date
    Nov 2007
    Posts
    35
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default slick

    bluewalrus: yes, each login will go to it's own directory.

    nile: that works pretty slick. the only thing is I'm redirecting to an html page. so the protect.php isn't working for me. even if I make a .php file and put that protect code at the top it just goes back to the login. I'm sure I screwed something up somewhere, but the protect thing (while awesome) isn't a necessity for me.

    thanks!!

  5. #5
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Not sure if this will work or not more of a test code by me...

    PHP Code:
    <form action="<?php $user $_POST['user']; echo "http://www.yoursite.com/" $user "/index.php";?>" method="post">
    <input type="text" name="user" />
    <input type="password" name="pass" />
    </form>
    for eachuser/index.php:
    PHP Code:
    <?php
    $user 
    $_POST['user'];
    $pass $_POST['pass'];
    if (
    $user == "user") {
    if (
    $pass == "pass") {
    content of page
    }
    }

    else {
    die (
    "You do not have permission to access this page.");
    }
    ?>

  6. #6
    Join Date
    Jan 2008
    Posts
    4,158
    Thanks
    28
    Thanked 623 Times in 619 Posts
    Blog Entries
    1

    Default

    Great! Glad to help you! Your welcome!

    It seems your topic is solved... Please set the status to resolved.. To do this:
    Go to your first post ->
    Edit your first post ->
    Click "Go Advanced" ->
    Then in the drop down next to the title, select "RESOLVED"
    Jeremy | jfein.net

  7. The Following User Says Thank You to Nile For This Useful Post:

    lrickyutah (03-12-2009)

Bookmarks

Posting Permissions

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