View Single Post
  #11 (permalink)  
Old 02-04-2008, 01:42 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Joomla introduction?

Quote:
Originally Posted by Falcon View Post
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
is there any way to decrypt the password?
__________________
With,
J. Jeyaseelan

Everything Possible
Reply With Quote