prepare("SELECT id, username, emailaddress, registered, token, temporarypass, enabled FROM app_users WHERE registered=? AND token=? AND enabled=?");
$query0->bind_param("isi", $registered, $retrievedToken, $enabled);
$query0->execute();
$fetchedrow = $query0->get_result()->fetch_assoc();
if (!$fetchedrow) {
exit("Error !");
} else {
$userID = $fetchedrow['id'];
$userName = $fetchedrow['username'];
$tempPassword = $fetchedrow['temporarypass'];
$useremail = $fetchedrow['emailaddress'];
$query1 = $mysqli->query("UPDATE app_users SET registered = '1', token = '', temporarypass = '' WHERE id = '$userID'");
header("Location: new-email-message.php");
// Send the new email
$domaininit = explode(".", $_SERVER['HTTP_HOST']);
array_shift($domaininit);
$domain = implode(".", $domaininit);
$reqHost = $_SERVER['HTTP_HOST'];
// Mention the content-type, since it's an HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
$headers .= "From: " . "no-reply@" . $domain . "\r\n";
$subject = "Roundpin account access";
$message = "Hello,
You can log in to your Roundpin account using the following credentials:
username: ".$userName."
password: ".$tempPassword."
We highly recommend to change the password provided in this email with a new strong password. After you log in to Roundpin, click on the 'Account Settings'
wheel, click on 'Configure Account', then click on the 'Change Password' tab; enter your current password and a new password of at least 10 characters,
containing at least one letter, one digit and one special character.
Thank you,
Roundpin
Host: '" . $reqHost . "'";
mail($useremail, $subject, $message, $headers);
}
}
?>