From e58ad958e215d805b19ac1da87202db6cfa93e6c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 19 Feb 2003 04:10:23 +0000 Subject: [PATCH] email update svn path=/trunk/boinc/; revision=939 --- html/user/util.inc | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/html/user/util.inc b/html/user/util.inc index 1dbd00ae5b..77bc532368 100644 --- a/html/user/util.inc +++ b/html/user/util.inc @@ -60,15 +60,6 @@ function get_user_from_auth($auth) { return NULL; } -function get_user_from_cookie() { - $auth = ""; - $c = getenv("HTTP_COOKIE"); - $d = str_replace("; ", "&", $c); - parse_str($d); - if ($auth) return lookup_user_auth($auth); - return NULL; -} - function show_login($user) { if ($user) { echo "Logged in as %s.\n", $user->name; @@ -206,4 +197,39 @@ function no_cache() { header ("Pragma: no-cache"); // HTTP/1.0 } +// A few functions relating to email-address munging +// A "munged" email address is of the form @X_Y, +// where X is a valid email address and Y is a random string. +// When an email address hasn't been validated yet, it's munged. +// (Used during account creation and email address changes) + +// a valid email address is of the form A@B.C +// where A, B, C are nonempty and don't contain @ or . +// +function is_valid_email_addr($addr) { + $x = strstr($addr, "@"); + if (!$x) return false; + if (strlen($x) == strlen($addr)) return false; + $x = substr($x, 1); + if (strstr($x, "@")) return false; + $y = strstr($x, "."); + if (!$y) return false; + if (strlen($y) == strlen($x)) return false; + if (strlen($y) == 1) return false; + $y = substr($y, 1); + if (strstr($y, ".")) return false; + if (strlen($y) == 0) return false; + return true; +} + +function munge_email_addr($email, $string) { + return "@$email_$string"; +} + +// if email_addr is of the form @X_Y, split out the X and return true. +// otherwise return false +// +function split_munged_email_addr($addr, $string, &$email) { +} + ?>