Results 1 to 4 of 4

Thread: Auth page

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139

    Unhappy Auth page

    Hi All,

    As you can see I've finally got my signup.php page working, I want to have a login.php page.

    I've looked around hotscripts ect for a script but am not having any luck. I guess it will go something like this


    PHP Code:
    <?php 
    mysql_connect 
    (localhostuserpassword); 
    mysql_select_db (nz); 
    $qry mysql_query("SELECT user_name, user_password FROM DB_Users");
    $arr mysql_fetch_array($qry);

    if (
    $_POST['action'] == 'save') { 

    if(
    $_POST['user_name'] == $_POST ['user_name']){

    \\ 
    set cookie information
    }
    }else{
    echo 
    "Your passwords don't match.";  
    }
    } else { 
    ?>
    this is way wrong but does anyone have a basic code that will help me??

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    In your code you're comparing one value to itself.. nothing's going to happen.

    This should work for you:

    Code:
    <?php  
      mysql_connect ('localhost', 'user', 'password');  
      mysql_select_db ('nz');  
      $qry = mysql_query("SELECT user_name FROM DB_Users WHERE user_name='$_POST[user_name]' AND user_password='$_POST[user_password]';"); 
      $arr = mysql_fetch_array($qry); 
    
      if($_POST['action'] == 'save'){  
        if($arr[0] != ""){ 
          echo "Authenticated.\n";
          //set cookie information 
        }else{ 
          echo "The server could not authenticate your account information.\n";   
        } 
      }else{  
        echo "stuff for action that isn't 'save'\n";
      }
    ?>
    Like Archer? Check out some Sterling Archer quotes.

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    If this is for a login page, why is action 'save'?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139
    Originally posted by The Hobo
    If this is for a login page, why is action 'save'?
    it's a copy paste from the signup page, action maybe login

Posting Permissions

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



Click Here to Expand Forum to Full Width