i figured it out without using datamanager.
$salt = fetch_user_salt();
$password = hash_password($pw, $salt);
mysql_query("INSERT INTO user(usergroupid, username, password, email, usertitle, joindate, reputation, reputationlevelid, options, ipaddress, referrerid, salt) VALUES('2', '" . $user . "', '" . $password . "', '" . $email . "', 'Junior Member', '" . time() . "', '10', '4', '45108311', '" . $_SERVER['REMOTE_ADDR'] . "', '2', '" . $salt . "')");
}
}
function fetch_user_salt($length = 30)
{
$salt = '';
for ($i = 0; $i < $length; $i++)
{
$salt .= chr(rand(33, 126));
}
return $salt;
}
function hash_password($password, $salt)
{
// if the password is not already an md5, md5 it now
if ($password != '')
{
$password = md5($password);
}
// hash the md5'd password with the salt
return md5($password . $salt);
}
|