Thanks for signing up at EthicsCanvas.org!
Please click on the link below in order to verify your email address:
$activationLink
Thanks,
Ethics Canvas Team";
require_once('db_utils.php');
include('mailer.php');
$conn = db_connect(); // Connect to the database
// Check if the username already exists
if(!($result = mysqli_query($conn, "SELECT * FROM user WHERE username = '$email'"))) {
echo 400; // Wrong query
}
else {
if(mysqli_num_rows($result) > 0) { // User already registered - not allow
echo 401;
}
else {
// Register the new user
if(!mysqli_query($conn, "INSERT INTO user (username, password, name, salt) VALUES ('$email', '$hash', '$name', '$salt')")) {
echo 400; // Wrong query
}
else {
smtpmailer($email, 'Welcome to ethicscanvas.org', $activationEmail, null);
echo 201;
}
}
}
mysqli_free_result($result);
db_close($conn); // Close the database
}
?>