From 081bc1b18716ea460286402f2de829b0dd258be1 Mon Sep 17 00:00:00 2001 From: james Date: Fri, 9 Oct 2009 15:47:25 +0000 Subject: [PATCH] Really make sure they cant add auser with an email address that already exists --- admin/donors.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/admin/donors.php b/admin/donors.php index 68f0d50..ae0cf3b 100644 --- a/admin/donors.php +++ b/admin/donors.php @@ -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 ";