Forum Moderators: coopster
this is the call from the registration page
if (isset($_POST["submit"])) {
$res = registerUser($_POST["user"], $_POST["pass"], $_POST["email"], $_POST["first_name"], $_POST["last_name"], $_POST["phone"], $_POST["alt_phone"], $_POST["fax"], $_POST["agree"]);
and the function it calls for the registration is
function registerUser($user, $pass, $email, $first_name, $last_name, $phone, $alt_phone, $fax, $agree)
{
global $admin_name;
global $admin_email;
global $site_url;
$user = codeClean($user);
$email = codeClean($email);
$first_name = codeClean($first_name);
$last_name = codeClean($last_name);
$phone = codeClean($phone);
$alt_phone = codeClean($alt_phone);
$fax = codeClean($fax);if (checkIfUser($user)){
return 1;
} elseif (!validateEmail($email)) {
return 2;
} elseif (!validateUsername($user)) {
return 3;
} elseif (checkIfEmail($email)) {
return 4;
} elseif (empty($agree)) {
return 5;
} else {
//if blank password one is generated then the details are emailed
if (empty($pass)) {
$pass = generatePassword(6);
//build email to be sent from lang file
$body = eregi_replace("%USERNAME%","$user",ACCT_SIGNUP_BODY);
$body = eregi_replace("%PASSWORD%","$pass", $body);
$body = eregi_replace("%URL%","$site_url/login.php", $body);
$subject = eregi_replace("%URL%","$site_url",ACCT_SIGNUP_SUBJECT);
$subject = eregi_replace("%USERNAME%","$user", $subject);
sendEmail($email,$subject,$body,$admin_name,$admin_email);
}
// Get remote IP
$ipaddress = getenv('REMOTE_ADDR');
$reg_date = date("Y-m-d H:i:s");
//Encrypt password for database
$salt = 's+(_a*';
$pass = md5($pass.$salt);
$sql = "INSERT INTO users (ipaddress,user,pass,email,first_name,last_name,phone,alt_phone,fax,reg_date) VALUES (INET_ATON('" . $ipaddress . "'), '" . $user . "','" . $pass . "', '" . $email . "', '" . $first_name . "', '" . $last_name . "', '" . $phone . "', '" . $alt_phone . "', '" . $fax . "', '" . $reg_date . "')";
$res = mysql_query($sql);
return 99;
}
}
The issue is one of the users when they enter in a password a password is still generated
"When adding new users with passwords entered, it still sends a new password for the new account. therefore with the settings that had been inputted originally only the newly emailed password works."
Apache server running 1.3.41 w/ cPanel front end version 11.18.3. MySql version - 5.0.45.
Any ideas on what is wrong with my code as it works on many different setups and this is the first person to submit this as a bug I can't figure it out.
Any help is appreciated.
Best Regards,
Brandon