SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone know how to make a site where the form/php-script looks for username and password in a mysql database.
    I know I can use a .htaccess file but it seems like i can't use it with win2k/apache.
    If anyone have an idea how to deal with this issue I would be grateful //Magnus

  2. #2
    Freelance Web Designer KeithMcL's Avatar
    Join Date
    Oct 1999
    Location
    Dublin, Ireland
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    You can search the database for the username and password with something like this:
    Code:
    $query = "SELECT id FROM users WHERE username='$username' AND password ='$password'";
    
    $number1 = mysql_query($query);
    $numrows = mysql_num_rows($number1);
    
    if(($numrows == 1))
    {
    // Code for an authorized user goes here
    }
    else
    {
    // Code for unauthorized user goes here
    }
    You can put this is in a function so that when a user is authorized it writes a cookie for this session so you can pass variables from page to page.


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
  •