Jump to content

Recommended Posts

Apparently everytime I run this query it always claims it's the wrong password when I encrypted it in the correct way.

 

$escape = mysql_real_escape_string($_POST['password']);
$escape2 = mysql_real_escape_string($_POST['username']);
$query = mysql_query("SELECT * FROM Accounts WHERE Name ='" . $escape2 . "' AND Password = md5(sha1('" . hash( 'whirlpool', $escape ) . "'))") or die('Cannot Execute:'. mysql_error());

 

If you're curious how I encrypted it view here: (This is from another language)

mysql_real_escape_string(inputtext, Escape[0]);
WP_Hash(Escape[1], 150, Escape[0]);
format(string, STR_SIZE, "SELECT * FROM Accounts WHERE Name = '%s' AND Password = md5(sha1('%s'))", GetUserName(playerid), Escape[1]);
if(!mysql_query(string)) SendScriptError(playerid, MySQL_ERROR_CHECKPASSWORD_FAILURE);

Link to comment
https://forums.phpfreaks.com/topic/208375-invalid-password-strangly/
Share on other sites

A) Is your password field in your table large enough to hold an md5() value (32 hex characters), and

B) You are the only one here who can troubleshoot what your code is doing. How about checking if the value your query produces (form a SELECT query using the same logic you are putting into the WHERE clause) and what is actually stored in your database are the same.

A) Is your password field in your table large enough to hold an md5() value (32 hex characters), and

B) You are the only one here who can troubleshoot what your code is doing. How about checking if the value your query produces (form a SELECT query using the same logic you are putting into the WHERE clause) and what is actually stored in your database are the same.

 

Hi, printing out the whirlpool shows about 20+ characters, once doing that in another language and implementing it, the database only stops at about 10 characters, how can I increase the maximum character size in the Password field?

So, did you even make an effort to find and change the size of your password field?

 

Obviously, otherwise I wouldn't even be replying, would I?

 

Are you using MySQL's MD5/SHA hash or PHP's

 

If you meant to use PHP's then you have a parse error  -try this

cape2 . "' AND Password = '" . md5(sha1(hash( 'whirlpool', $escape ). "') or die

 

Both. I'll check out the code.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.