aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2001-08-24 15:47:14 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2001-08-24 15:47:14 +0000
commit1330d26720d11487ff28d1611d1050b0a29382bc (patch)
tree0e11075d0c6d9ac152e97b7b78424157b2bd1da3 /phpBB/includes/functions.php
parent8723edc8c8cbe0b69a06275b9deb0b8be5430fad (diff)
downloadforums-1330d26720d11487ff28d1611d1050b0a29382bc.tar
forums-1330d26720d11487ff28d1611d1050b0a29382bc.tar.gz
forums-1330d26720d11487ff28d1611d1050b0a29382bc.tar.bz2
forums-1330d26720d11487ff28d1611d1050b0a29382bc.tar.xz
forums-1330d26720d11487ff28d1611d1050b0a29382bc.zip
Thought it best to add the email validate now
git-svn-id: file:///svn/phpbb/trunk@931 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index ce2160437b..05f8f1e5af 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -455,6 +455,52 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
}
//
+// Check to see if email address is banned
+// or already present in the DB
+//
+function validate_email($email)
+{
+ global $db;
+
+ if($email != "")
+ {
+ $sql = "SELECT ban_email
+ FROM " . BANLIST_TABLE;
+ if(!$result = $db->sql_query($sql))
+ {
+ message_die(GENERAL_ERROR, "Couldn't obtain email ban information.", "", __LINE__, __FILE__, $sql);
+ }
+ $ban_email_list = $db->sql_fetchrowset($result);
+ for($i = 0; $i < count($ban_email_list); $i++)
+ {
+ $match_email = str_replace("*@", ".*@", $ban_email_list[$i]['ban_email']);
+ if( preg_match("/^" . $match_email . "$/is", $email) )
+ {
+ return(0);
+ }
+ }
+ $sql = "SELECT user_email
+ FROM " . USERS_TABLE . "
+ WHERE user_email = '" . $email . "'";
+ if(!$result = $db->sql_query($sql))
+ {
+ message_die(GENERAL_ERROR, "Couldn't obtain user email information.", "", __LINE__, __FILE__, $sql);
+ }
+ $email_taken = $db->sql_fetchrow($result);
+ if($email_taken['user_email'] != "")
+ {
+ return(0);
+ }
+
+ return(1);
+ }
+ else
+ {
+ return(0);
+ }
+}
+
+//
// Check to see if the username has been taken, or if it is disallowed.
// Used for registering, changing names, and posting anonymously with a username
//