Results 1 to 4 of 4

Thread: Ask help with the first login page

  1. #1
    Join Date
    Mar 2004
    Posts
    12

    Cool Ask help with the first login page

    I try to create my first login page of web database application. I am using PHP/MySQL in Dreamweaver MX. I am using Apache web service. I have searched a lot of web site. I couldn't find anything to help my start. There are a lot of ASP demo or wizard. But I have to do with PHP/MySQL in Dreamweaver MX. Hope I can find some experts help with my application.

    Thanks a lot!

  2. #2
    Join Date
    Jan 2004
    Location
    Cincinnati, OH
    Posts
    30


    Do you have your database created? If so, what is the schema?

  3. #3
    Join Date
    Jan 2004
    Location
    Cincinnati, OH
    Posts
    30
    Any other details such as your code that you have developed so far would be extremely helpful as well.

  4. #4
    Join Date
    Jan 2004
    Location
    Cincinnati, OH
    Posts
    30
    Hello,

    I sent you a message, but I thought I would post the response in case anyone else has questions about this same thing.



    // Variables Passed from Login Form

    $username
    $password


    <?

    // Database Variables
    $dbhost = "localhost";
    $dbname = "database_name";
    $dbuser = "root";
    $dbpwd = "";



    mysql_connect($dbhost,$dbuser,$dbpwd)
    or die("<br>ERROR: Unable to connect to database server.<br>\n");

    $dbquery = "SELECT username, password FROM users WHERE username='$username' AND password='$password'";


    $result = mysql_db_query($dbname,$dbquery)
    or die("<br>ERROR: Unable to Insert & Update records.<br>\n");

    $count = mysql_num_rows ($result);

    mysql_close();


    if ($count > 0) {
    // Then there is a match, so they should be granted access
    } else {
    // There was not a match, so they are not allowed in or they entered in a bad username and password combination
    }

    ?>


    This is not the only way to do this, but it does work. Someone may have a better solution, but I know this works and can be the basis for most look-up type functions.

Posting Permissions

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