Hello ,
i make plug to add new user , user can register Directly from a link like this
misc.php?do=register&username=
mark&email=
mark@yahoo.com&password=
67309
i get info from link and insert them on user table , No problem
My problem only , how i Generate the pass-hash and Generate salt ?!
i found this function on includes/functions_user.php
PHP Code:
function fetch_user_salt($length = 3)
{
$salt = '';
for ($i = 0; $i < $length; $i++)
{
$salt .= chr(vbrand(33, 126));
}
return $salt;
}
it that Generate the salt ? and how can i used it ?
--------------- Added [DATE]1402164924[/DATE] at [TIME]1402164924[/TIME] ---------------
Thanks ... I found the solution and works well
PHP Code:
// get password from link
$pass = $pass = $_GET['password'];
// Generate salt
function createSalt() {
$salt = '';
for ($i = 0; $i < 30; $i++) {
$salt .= chr(rand(33, 126));
}
return $salt;
}
//Generate password hash
function createPassword($password, $salt) {
return md5(md5($password) . $salt);
}
// Now you can store salt and password in your database .
$salt = createSalt();
$password = createPassword($pass, $salt);