Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder fireblade's Avatar
    Join Date
    May 2007
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Password Verification ?

    I am creating a user login page using PHP/MySQL. I want to verify the password in the database and which user enters during the login information page.

    I have encrypted the Password in database using
    Code:
    Password('$password')
    Do I need to decrypt the password in database to verify it with the login entry password?

    Or what are there any other ways? can any one give me a way
    Fi®e bLádê
    follow me on twitter

  • #2
    Banned
    Join Date
    Apr 2007
    Posts
    428
    Thanks
    29
    Thanked 5 Times in 5 Posts
    why don't you just try it?

  • #3
    New to the CF scene
    Join Date
    May 2007
    Location
    Phil
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hello, i used md5 for the encryption. to verify log in, i used the following codes:

    $uname = $_GET['username'];
    $pwd = md5($_GET['password']);

    $qry_result = mysql_query("SELECT * FROM USERS WHERE USERNAME='$uname' and PASSWORD='$pwd'");

    if((mysql_num_rows($qry_result) == 0)) {
    //INVALID LOG IN
    }
    else{
    //VALID. do your stuffs here
    }

  • #4
    New Coder
    Join Date
    Sep 2006
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've used MD5 in the past and I would go that route. Good Hashbrowns

  • #5
    New Coder fireblade's Avatar
    Join Date
    May 2007
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what about the way I have used here beLow??
    PHP Code:
    function is_password_match($username$userpass) {

        
    $SQL=SELECT userID FROM user WHERE userID='$username' AND password=Password('$userpass');
        
        
    $id=db_connect();
        if (
    $id) {
            
    $rs=mysql_query($SQL$id);
            
    $num_rows=mysql_num_rows($rs);

            if (
    $num_rows<1) {
                
    db_close($id);
                return 
    false;
                exit();
            }
            else if (
    $num_rows=1) {
                
    db_close($id);
                return 
    true;
                exit();
            }
            else {
                
    db_close($id);
                return 
    false;
                exit();
            }
        }
        return 
    false;

    any suggestion?
    Thanks everybOdy!
    Fi®e bLádê
    follow me on twitter


  •  

    Posting Permissions

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