
02-12-2008, 12:48 AM
|
| D-Web Sr.Programmer | | Join Date: Dec 2007
Posts: 103
| |
Re: Joomla introduction? Quote:
Originally Posted by Falcon Hi Pugalanthi
For registration, We have to get the password from the input field then we have to create a salt(key) in 16 digit value dynamically then encrypt the password using that salt(key), then concatenate that encrypted password and salt(key), then inserted into your table, for example $vPassword=$_POST['txtPassword'];
$salt = mosMakePassword(16);
$crypt = md5($vPassword.$salt);
$vPassword = $crypt.':'.$salt;
For Login, Get the username or userid fetch the password from the user table split the password into two part using explode and List function take the salt(key) value for that splited data then encrypted that given password using that salt(key). Check the ecncrypted given password and splited password or equal if its not equal send the error message invalid password. use the same concept for change password also, Example for login password check $vUsername=$_POST['txtUsername'];
$vPassword=$_POST['txtPassword'];
$vSql="select password from #__users where username = "$vUsername;
$database->setQuery($vSql);
$database->loadObject($vRow)
list($hash, $salt) = explode(':', $row->password);
$cryptpass = md5($vPassword.$salt);
$check = strcmp($hash,$cryptpass);
if($check != 0)
{
echo "Invalid Password";
}
Regards
Falcon  | Thnaks for the coding. I have already downloaded Joomla on my computer and I'm also thinking of asking the same question. I 'm glad to see this coding. It has save me a lot of head aches. |