SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Wierd - Query failing from function?

  1. #1
    SitePoint Zealot allanon's Avatar
    Join Date
    Jan 2005
    Location
    United States
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wierd - Query failing from function?

    Hello, I have a variable, i'll say it's named $password. T

    PHP Code:
    $encrypted_password 'long string';
    $decrypted_password decrypt($encrypted_password);
    echo 
    $decrypted_password;
    // echo outputs the correct password //
    $select mysql_query("SELECT * FROM users WHERE login_id = $id AND password = '$decrypted_password'") or die(mysql_error());
    // the select fails //
    // when I replace $decrypted_password with the password, it works // 
    Changing $decrypted_password to the correct password also makes the query successful.

    The "decrypt()" function *is* decrypting it, but it won't work in the query?!?
    - Monster!

  2. #2
    SitePoint Zealot allanon's Avatar
    Join Date
    Jan 2005
    Location
    United States
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I think i will simply use md5/sha1. I am storing the encrypted password in a cookie to keep users logged in. Do you think a var that is md5() could be decrypted?
    How bout a sha1(md5($var))? Or is md5($var) enough?
    - Monster!

  3. #3
    SitePoint Zealot Ap0s7le's Avatar
    Join Date
    Jul 2003
    Location
    Lousiville, KY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why would you have to decrypt it anyhow? I'd take their pass, encrypt or MD5 it and then validate against what's in the DB. Also I personally use MD5, because you can't 'decrypt' it due to it not being encrypted, it's a hash.

    so long
    Last edited by Ap0s7le; Feb 6, 2005 at 21:27. Reason: Bah, can't spell!

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
  •