Ok here is my problem the following code is to validate emails and also sends my the email via vbscipt it works when i use
getURL(“http://mywebsite.com/action.asp”, 0, “POST”);
but that creates a popup so i tried
loadVariablesNum(“http://mywebsite/action.asp",0,"post”);
but for some reason that doesn’t work any help would be great thanks
function validate_mail(EM) {
// 1. Check whether there is an "@" in the address
primo = new String();
primo = EM.toLowerCase();
primo_array = new Array();
primo_array = primo.split("@");
if (primo_array.length == "2") {
trace("First test passed");
// 2. Second test - check if there is something before the "@", and that that prefix doesn't start with a "." or ends with a "."
prefix = new String();
prefix = primo_array[0];
if (prefix.length>0 && prefix.charAt(0) != "." && prefix.charAt(prefix.length-1) != ".") {
trace("Second test passed");
// 3. Third test - check if there is at least one point behind the "@"
suffix = new String();
suffix = primo_array[1];
suffix_array = new Array();
suffix_array = suffix.split(".");
if (suffix_array.length>1) {
trace("Third test passed");
// 4. Fourth test - check if there is are at least two, max 4 letters behind the last point
// First, the function must take the string behind the last point - the Top Level Domain (TLD)
index_of_suffix_array = suffix_array.length-1;
// Take the string of the last part of the suffix
TLD = new String();
TLD = suffix_array[index_of_suffix_array];
trace("TLD ="+TLD+"// TLD.length ="+TLD.length);
if (TLD.length>1 && TLD.length<5) {
trace("Fourth test passed");
// 5. Fifth test - check that there is at least one letter between every point in the suffix
suffix_particle = new String();
for (i=0; i<=suffix_array.length-1; i++) {
suffix_particle = suffix_array*;
if (suffix_particle.length>0) {
trace("Fifth test passed");
if (i == suffix_array.length-1) {
// 6. Sniffing if there are unauthorised chars residing in the Email Address
char = new Array();
for (k=0; k<=primo.length-1; k++) {
char = primo.slice(k, k+1);
trace(char);
// Allowed characters of your choice can be added in statement below
if (char == "a" || char == "b" || char == "c" || char == "d" || char == "e" || char == "f" || char == "g" || char == "h" || char == "i" || char == "j" || char == "k" || char == "l" || char == "m" || char == "n" || char == "o" || char == "p" || char == "q" || char == "r" || char == "s" || char == "t" || char == "u" || char == "v" || char == "w" || char == "x" || char == "y" || char == "z" || char == "0" || char == "1" || char == "2" || char == "3" || char == "4" || char == "5" || char == "6" || char == "7" || char == "8" || char == "9" || char == "." || char == "@" || char == "_" || char == "-") {
// The following statement checks if every character has passed the last test
// And executes the succeeding message.
if (k == primo.length-1) {
// Actual statement when all tests are passed
// If your Mail Address needs to be sent when it is compliant - this is where you send it.
//getURL("http://mywebsite/action.asp", 0, "POST");
loadVariablesNum("http://mywebsite/action.asp",0,"post");
result = "Thank you for submitting !";
_root.pages4.success_mc._visible = (1);
_root.pages4.success_mc.gotoAndPlay(2);
}
} else {
// Result if Test 6 fails
trace("Unauthorised character "+char);
result = "Unauthorised character "+char;
break;
}
}
}
} else {
// Result if Test 5 fails
trace("Error in delimiters (.)");
result = "Error in delimiters (.)";
break;
}
}
} else {
// Result if Test 4 fails
trace("Error in TLD");
result = "Error in TLD";
}
} else {
// Result if Test 3 fails
trace("Error in the suffix");
result = "Error in the suffix";
}
} else {
// Result if Test 2 fails
trace("Malformed Prefix or Missing Prefix");
result = "Malformed Prefix or Missing Prefix";
}
} else {
// Result if Test 1 fails
trace("Mail must contain one @");
result = "Mail must contain one @";
}
}