Really make sure they cant add auser with an email address that already exists

This commit is contained in:
james 2009-10-09 15:47:25 +00:00
parent 1f244c8375
commit 081bc1b187

View File

@ -223,6 +223,15 @@ function save_contact(){
if(validate_contactdata()){
// load or create the user, according to the situation
if($_POST['recordtype'] == 'new'){
if($_POST['email']) {
$q=mysql_query("SELECT *,MAX(year) FROM users WHERE email='".trim($_POST['email'])."' GROUP BY uid HAVING deleted='no'");
if(mysql_num_rows($q)) {
error_("A user with that email address already exists");
exit;
}
}
// this is a new record being submitted. Create the user.
$successMessage = "Contact created successfully";
$successLog = "Added contact ";