www.webdeveloper.com
Results 1 to 7 of 7

Thread: Individual login from one database

  1. #1
    Join Date
    Mar 2006
    Posts
    15

    Individual login from one database

    I may not be asking this in the right fourm section, but here it goes.

    I have used the tutorial (http://www.tutorialized.com/tutorial...ogin-Page/4206) to create a login page in dreamweaver, and it works great.

    The question is how do I alter my database so that each username when submitted will go to their own page.

    ie. if someone types in login:fire password:fox it will go to www.firefox.com
    and if someone types in login:internet password:explorer it will go to www.yousuck.com

    I am assuming in need to make another column in the table, but what do I do with it?

  2. #2
    Join Date
    Feb 2006
    Posts
    520
    You'll have to do some custom programming. First add another field to your database and call it userURL.
    On your login page where you redirect user after succesfull login just plugin that field!

  3. #3
    Join Date
    Mar 2006
    Posts
    15
    I created a new column in my database which contains specific URLs. And then in dreamweaver, where I'm asked to put in my redirectLoginSuccess I put in my column title. But then when I login, the brower tries to find that title, not the entry within the column.

    I tried creating a recordset (no idea what that is), but it did'nt work properly, and just gave me an error when trying to open up the apge.

    Any help?

  4. #4
    Join Date
    Feb 2006
    Posts
    520
    what server side are you using?

    When your form checks the login credentials it queries the db and returns user info, just include that new field into the query and then you can pass it along. Send you form source code!

  5. #5
    Join Date
    Mar 2006
    Posts
    15
    Here is the code I'm using...I realize now that I have to "define" $url. I'm just not to sure how to do that. (I have attempted to, as can be seen below) Thanks for your help!


    <?php require_once('Connections/Login.php'); ?><?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
    session_start();
    }

    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
    $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    }

    if (isset($_POST['username'])) {
    $loginUsername=$_POST['username'];
    $password=$_POST['password'];
    $url=$_POST['url'];
    $MM_fldUserAuthorization = "";
    $MM_redirectLoginSuccess = "$url";
    $MM_redirectLoginFailed = "http://www.nhl.com";
    $MM_redirecttoReferrer = false;
    mysql_select_db($database_Login, $Login);

    $LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'",
    get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

    $LoginRS = mysql_query($LoginRS__query, $Login) or die(mysql_error());
    $loginFoundUser = mysql_num_rows($LoginRS);
    if ($loginFoundUser) {
    $loginStrGroup = "";

    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;

    if (isset($_SESSION['PrevUrl']) && false) {
    $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
    }
    header("Location: " . $MM_redirectLoginSuccess );
    }
    else {
    header("Location: ". $MM_redirectLoginFailed );
    }
    }
    ?>

  6. #6
    Join Date
    Feb 2006
    Posts
    520
    I am not that good with php but try this;

    add your url field into the query
    PHP Code:
    $LoginRS__query=sprintf("SELECT username, password, URLFIELD FROM users WHERE username='%s' AND password='%s'"
    and plug it into this
    PHP Code:
    $MM_redirectLoginSuccess "$url"

  7. #7
    Join Date
    Mar 2006
    Posts
    15
    Hey,

    Thanks for you help, but still nothing is happening. I'm going to post this in the php section of the fourm and see if i can get more anwsers.

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