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 3 of 3

Thread: Login Problem

  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation Login Problem

    The data is entered correctly but loginis the problem. plz help..

    here's the code.

    "

    <?php
    include 'connection.php';


    $username=mysql_real_escape_string($_POST['username']);
    $password=mysql_real_escape_string($_POST['password']);
    $getsalt=mysql_query("select salt from register where username='$username'");

    printf "$getsalt";

    $saltpassword=$getsalt.$password;

    echo "$saltpassword";

    $hashpassword=hash('sha256',$saltpassword);

    $compare=mysql_query("select * from register where username='username' and password='$hashpassword';");

    $count=mysql_num_rows($compare);

    if($count==1)
    {
    echo "Hello $username";
    }
    else
    {
    echo "Error";
    }

    mysql_close($con);


    ?>

    "

  • #2
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    PHP Code:
    $compare=mysql_query("select * from register where username='$username' and password='$hashpassword'"); 
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • Users who have thanked AndrewGSW for this post:

    snippercs (08-18-2012)

  • #3
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by AndrewGSW View Post
    PHP Code:
    $compare=mysql_query("select * from register where username='$username' and password='$hashpassword'"); 
    thanks.. helped a little.. still its says

    Resource id #5qwertyError

    " Resource id #5qwerty " is the $saltpassword its printing.

    sorry to bother so much.. but am really a NEWBIE :-/


    GOT THE SOLUTION.. GOOGLE ROCKS

    $getsalt=mysql_query("select salt from register where username='$username'");
    $arr = mysql_fetch_array($getsalt);
    $results2 = $arr[0];
    Last edited by snippercs; 08-18-2012 at 08:03 PM.


  •  

    Posting Permissions

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