Skip to content
Snippets Groups Projects
Commit c687d9d2 authored by Graham Cole's avatar Graham Cole
Browse files

use the site e-mail validation function for the SUCS blogs stuff to avoid a namespace clash

parent ba0ef61b
No related branches found
No related tags found
No related merge requests found
...@@ -5,32 +5,6 @@ function safeuname($name) ...@@ -5,32 +5,6 @@ function safeuname($name)
if (strlen($name) < 2) return FALSE; if (strlen($name) < 2) return FALSE;
return ereg("^[a-z][a-z0-9_]*$", $name); return ereg("^[a-z][a-z0-9_]*$", $name);
} }
//check for a valid email address
function validEmail ($email)
{
global $error;
//split user and domain
list($user,$domain) = explode("@", $email);
// check for bad characters, and check for zero length user & domain
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$email) or !$user or !$domain )
{
$error = 'an invalid email address (syntax)';
return false;
}
// Syntax OK
// Check for an mail server
elseif(!getmxrr($domain,$mx) or !gethostbyname($domain))
{
$error = "no mail servers listed for '$domain'";
return false;
}
else
{
// Email address valid from technical point of view
return true;
}
}
// Find out if a given user has a blog // Find out if a given user has a blog
function blogger ($user) { function blogger ($user) {
...@@ -40,4 +14,5 @@ function blogger ($user) { ...@@ -40,4 +14,5 @@ function blogger ($user) {
else return false; else return false;
} }
require_once($base."/lib/validation.php");
?> ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment