Deprecated: Function get_magic_quotes_gpc() is deprecated in /home1/demos1s/public_html/software/b2b/core/softbiz_functions.php on line 497
Deprecated: Function get_magic_quotes_gpc() is deprecated in /home1/demos1s/public_html/software/b2b/core/softbiz_functions.php on line 497
Deprecated: Function get_magic_quotes_gpc() is deprecated in /home1/demos1s/public_html/software/b2b/core/softbiz_functions.php on line 497
Deprecated: Function get_magic_quotes_gpc() is deprecated in /home1/demos1s/public_html/software/b2b/core/softbiz_functions.php on line 497
Deprecated: Function get_magic_quotes_gpc() is deprecated in /home1/demos1s/public_html/software/b2b/core/softbiz_functions.php on line 497
function emailCheck (emailStr)
{
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null)
{
alert("Email Address seems incorrect (check @ and .'s)")
return false
}
var user=matchArray[1]
var domain=matchArray[2]
if (user.match(userPat)==null)
{
alert("The username in the Email Address seems invalid")
return false
}
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null)
{ // this is an IP address
for (var i=1;i<=4;i++)
{
if (IPArray[i]>255)
{
alert("Destination IP in the Email Address is invalid")
return false
}
}
return true
}
var domainArray=domain.match(domainPat)
if (domainArray==null)
{
alert("The domain name in the Email Address seems invalid")
return false
}
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>4)
{
alert("Email Address must end in a valid domain or two letter country")
return false
}
if (len<2)
{
var errStr="Email Address is missing a hostname"
alert(errStr)
return false
}
return true;
}