View Single Post
  #9 (permalink)  
Old 02-01-2008, 04:53 AM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Joomla introduction?

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

Last edited by Falcon : 02-01-2008 at 05:01 AM.
Reply With Quote