# HG changeset patch # User Matti Hamalainen # Date 1446740765 -7200 # Node ID 6e8ae77e1a253357b909fc07999729a5e9e4ca6f # Parent 87eda2e9023fccd35c4cbbdac43a184b668e32bc Add better checks for e-mails. diff -r 87eda2e9023f -r 6e8ae77e1a25 msite.inc.php --- a/msite.inc.php Thu Nov 05 18:25:05 2015 +0200 +++ b/msite.inc.php Thu Nov 05 18:26:05 2015 +0200 @@ -640,12 +640,28 @@ stError("E-mail address not in proper format."); $res = FALSE; } - + else if (strlen($email) > SET_LEN_EMAIL) { stError("E-mail address too long, max ".SET_LEN_EMAIL." characters."); $res = FALSE; } + else + if (strlen($email) > 0) + { + if ($id !== false) + // By another ID, if we are updating an entry + $sql = stPrepareSQL("SELECT * FROM attendees WHERE id<>%d AND email=%s", $id, $email); + else + // Or just exists, if adding + $sql = stPrepareSQL("SELECT * FROM attendees WHERE email=%s", $email); + + if (($data = stFetchSQL($sql)) !== false) + { + stError("Someone with the same e-mail address is already registered."); + $res = FALSE; + } + } // Check if another user already exists if ($chk >= 2)