Jump to content
Larry Ullman's Book Forums

Recommended Posts

I want use SHA1 to hash the password instead hash_hmac() function and used the syntax in page 79

return mysqli_real_escape_string($dbc, sha1($password, true)); but it looks still the database storing hash_hmac()

instead of sha1.


please help.

Link to post
Share on other sites

Good Morning.


I am using Zend framework accessing the login page:

$adapter = new Zend_Auth_Adapter_DbTable($dbRead, 'users', 'username', 'password', 'sha1(?)');

also I tested in dreamweaver log in user server behavior:

if (isset($_POST['password'])) {$_POST['password'] = sha1($_POST['password']); }


The thing is both logins fails. I think since the password stored as binary it cannot be dycrypted.

is there anyway we can store the password SHA1 or MD5 directly in the database instead hash_hmac()



Link to post
Share on other sites

Good Morning Larry.


After user registers successfully, The email for registration confirmation I want include a link to an activation page site. at Page 90

Now I have activate page and code column set to NULL value so to complete the activation process it looks I am missing some php script which I want some help from you.


I hope you understand, English is my second language



Link to post
Share on other sites

Okay. I have an example of this in my "PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)" book. Basically you create a code, like the MD5() version of the user's registration date and time. You then create a link to activate.php?x=email@example.com&y=CODE, inserting the actual user's email address and code there. This link gets emailed to the user. The code needs to go in the database.


The activate link then verifies those two pieces of information and sets the active column in the database to NULL if the provided values are correct. On the login page, you add an active IS NULL clause to the login query.


That's it!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...