I have verified that this does work very well infact…
<?
$name = $HTTP_POST_VARS[“fName_text”]." “.$HTTP_POST_VARS[“lName_text”];
$address = $HTTP_POST_VARS[“address_text”];
$city = $HTTP_POST_VARS[“city_text”];
$state = $HTTP_POST_VARS[“state_text”];
if (empty($HTTP_POST_VARS[“zip4_text”]))
{
$zip = $HTTP_POST_VARS[“zip_text”];
}
else
{
$zip = $HTTP_POST_VARS[“zip_text”].”-“.$HTTP_POST_VARS[“zip4_text”];
}
$phone = “(”.$HTTP_POST_VARS[“phone1_text”].”)“.$HTTP_POST_VARS[“phone2_text”].”-".$HTTP_POST_VARS[“phone3_text”];
$refer = $HTTP_POST_VARS[“referred_text”];
$how_hear = $HTTP_POST_VARS[“how_hear”];
$other = $HTTP_POST_VARS[“other_text”];
$dusername = $HTTP_POST_VARS[“username_text”];
$passwd = $HTTP_POST_VARS[“pass_text”];
$email = $HTTP_POST_VARS[“email_text”];
$toaddress = [email protected];
$subject = “Online Signup Request”;
function validate_email($Email) {
global $HTTP_HOST;
// Check for a malformed address (roughly)
if (!eregi(“+(.[_a-z0-9-]+)@[a-z0-9-]+(.[a-z0-9-]+)(.[a-z]{2,3})$”, $Email)) {
// it failed the simple format test, so return with an invalid address error
return 1;
}
// otherwise it passes the test so we can go off and do the ‘real’ validation
//
// first split #Email up into parts
list ( $Username, $Domain ) = split (“@”,$Email);
// look for an MX record and get the mail host name
if (checkdnsrr ( $Domain, “MX” )) {
if (getmxrr ($Domain, $MXrec)) {
// save the MX hostname ready for Phase 3 testing
$Mailserver = $MXrec[0];
} else {
// there is an MX record, but we failed to retrieve it
return 3; // return system error NOT invalid address
}
} else {
// in this case there isn’t an MX record so assume that the domain
// portion is also the name of the mail server itself (it can happen)
// save it as the mailserver address ready for Phase 3 testing
$Mailserver = $Domain;
}
// open a socket connection to the Mailserver
if ($Connection = fsockopen($Mailserver, 25)) {
// start the SMTP validation
if (ereg(“^220”, $Rubbish = fgets($Connection, 1024))) {
// it is an SMTP server so you can start talking to it
// Tell it who you are and get the response (not needed later).
fputs ( $Connection, "HELO $HTTP_HOST
" );
$Rubbish = fgets ( $Connection, 1024 );
// Ask it to accept mail from your $Email user - store the response (needed later)
fputs ( $Connection, “MAIL FROM: <{$Email}>
" );
$Fromstring = fgets ( $Connection, 1024 );
// Ask it to accept mail for your $Email user - store the response (needed later)
fputs ( $Connection, “RCPT TO: <{$Email}>
" );
$Tostring = fgets ( $Connection, 1024 );
// Now tell it you’re done with chatting
fputs ( $Connection, “QUIT
“);
// and close the connection
fclose($Connection);
// finally test the resonses did we get OK (type 250) messages?
if (ereg(”^250”, $Fromstring) && ereg(”^250”, $Tostring)) {
// YAHOOO … we got a good one
return 0; // return successful validation
} else {
// the server refused the user
return 1; // return invalid address
}
} else {
// connected, to something but it failed to identfy itself as an SMTP server
// so assume its a bogus address
return 1; // return invalid address error
}
} else {
// it failed to connect
return 1; // return invalid address or system error - its your call
}
}
if(validate_email($email)==1)
{
echo “ret_val=Invalid E-mail Address”;
exit;
}
if(validate_email($email)==2)
{
echo “ret_val=Error Validating E-mail Address”;
exit;
}
if(validate_email($email)==3)
{
echo “ret_val=Invalid Domain”;
exit;
}
if(validate_email($email) == 0)
{
$message = "User’s Name: “.$name.”
";
$message .= "User’s Address: “.$address.”
";
$message .= "User’s City: “.$city.”
";
$message .= "User’s State: “.$state.”
";
$message .= "User’s ZipCode: “.$zip.”
";
$message .= "User’s Phone: “.$phone.”
“;
if (empty($refer))
{
$message .= “Not referred by anyone”.”
";
}
else
{
$message .= "Referred By: “.$refer.”
";
}
$message .= "How did they hear about us: “.$how_hear.”
";
if (!empty($refer))
{
$message .= "Other Source: “.$other.”
";
}
$message .= "User’s Email: “.$email.”
";
$message .= "Desired Username: “.$dusername.”
";
$message .= "Password: ".$passwd;
mail($toaddress,$subject,$message,“From: $name <$email>”);
echo “ret_val=passed”;
exit;
}
?>
I, just for LSAG, put a hidden dynamic textfield in my movie, and called it ret_val, but everytime I run this, it returns “passed” even when it didn’t, and, here’s my actionscript…
if (ret_val =“”) {
gotoAndPlay(19);
}
if(ret_val=“passed”) {
gotoAndPlay(21);
}
else {
error_text = ret_val;
gotoAndPlay(18);
}
Frame 18 is my form, Frame 19/20 is the processing animation, and 21 -> is the remaining portion of my movie thanking the users for thier e-mail. So, if ret_val = “passed”, it shouldn’t be going back to 18 like it is… Hmmmmmm
I’m also having a problem with a variable being passed, but that’s something I can deal with seperatly…
Thanks again