steevo2 wrote:
> Hi, I have a login page and I want to encrypt the
password. Do I have to
> encrypt it first and then put it in the DB?
Yes. The best way to do this with PHP is to use the sha1()
function,
which produces a 40-character encryption of a string. This
means that
your password column in the database must be set to 40
characters wide.
Dreamweaver doesn't have a way to encrypt data before
inserting it in
the database, so you need to do it manually. Put this at the
top of the
page the contains the user registration form:
<?php
if (isset($_POST['password'])) {
$_POST['password'] = sha1($_POST['password']);
}
?>
> I did read on another site
> where you would need to put the passwords in the DB
already encrypted by PHP
> and then write a script to compare them.
All you need to do is add the same code as above at the top
of the page
that uses Dreamweaver's Log In User server behavior.
> want that ****** to show
> up in the password form field.
That is done by selecting Password as the Type for the input
TextField
element in the Property inspector.
--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/