form not submitting inofrmation
| From: | Bruce Gilbert | Date: | Fri, 16 Mar 2007 18:05:38 +0000 |
| Subject: | form not submitting inofrmation | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-250718@lists.php.net to get a copy of this message | ||
I have a form on my website, that used to work, but I just realized
that now it doesn't. You don't get any errors, but I am not receiving
an email with the information after the submittal.
The form is located at http://www.inspired-evolution.com/Contact.php
and the PHP is:
[php]
<?php
include("emailval.php");
$site_name = "Inspired-Evolution.com";
$site_owner_email = "webguync@gmail.com";
$your_domain = "www.inspired-evolution.com";
$current_url = $_SERVER['REQUEST_URI'];
$submit = $_REQUEST['submit'];
if(isset($submit)){
$name = $_REQUEST['name'];
$flizzum_flazzum = $_REQUEST['flizzum_flazzum'];
$subject = $_REQUEST['subject'];
$msg = $_REQUEST['msg'];
if(strlen($name) < 2){
$name_warn = "true";
}
if (MailVal($flizzum_flazzum, 2)){
$email_warn = "true";
}
if(strlen($msg) < 2){
$msg_warn = "true";
}
if (preg_match("/$your_domain/i", "$flizzum_flazzum")) {
$bogus_warn = "true";
}
if((!isset($name_warn))&&
(!isset($email_warn))&&
(!isset($bogus_warn))&&
(!isset($msg_warn))){
// headers for the email listed below
$headers .= "From: $name <$flizzum_flazzum>\n"; // your email client
will show the person's email address like normal
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; // sets
the mime type
$recipient = "webguync@gmail.com";
$subject = "Contact From $site_name - $subject"; // this is the
subject of the email
$msg = wordwrap( $msg, 1024 );
mail($recipient, $subject, stripslashes($msg), $headers); // the
mail() function sends the message to you
// if everything is OK, print a thanks message
print("<h3 class='thanks'> Hola $name, Thanks for getting in touch!</h3>
<p>We have received your e-mail and will respond at
<em>$flizzum_flazzum</em></p></div>");
exit;
}
}
?>
[/php]
emailval.php is
[php]
<?php
// hardcore e-mail validation
function MailVal($Addr, $Level, $Timeout = 15000) {
// Valid Top-Level Domains
$gTLDs = "com:net:org:edu:gov:mil:int:arpa:";
$CCs = "ad:ae:af:ag:ai:al:am:an:ao:aq:ar:as:at:au:aw:az:ba:bb:bd:be:bf:".
"bg:bh:bi:bj:bm:bn:bo:br:bs:bt:bv:bw:by:bz:ca:cc:cf:cd:cg:ch:ci:".
"ck:cl:cm:cn:co:cr:cs:cu:cv:cx:cy:cz:de:dj:dk:dm:do:dz:ec:ee:eg:".
"eh:er:es:et:fi:fj:fk:fm:fo:fr:fx:ga:gb:gd:ge:gf:gh:gi:gl:gm:gn:".
"gp:gq:gr:gs:gt:gu:gw:gy:hk:hm:hn:hr:ht:hu:id:ie:il:in:io:iq:ir:".
"is:it:jm:jo:jp:ke:kg:kh:ki:km:kn:kp:kr:kw:ky:kz:la:lb:lc:li:lk:".
"lr:ls:lt:lu:lv:ly:ma:mc:md:mg:mh:mk:ml:mm:mn:mo:mp:mq:mr:ms:mt:".
"mu:mv:mw:mx:my:mz:na:nc:ne:nf:ng:ni:nl:no:np:nr:nt:nu:nz:om:pa:".
"pe:pf:pg:ph:pk:pl:pm:pn:pr:pt:pw:py:qa:re:ro:ru:rw:sa:sb:sc:sd:".
"se:sg:sh:si:sj:sk:sl:sm:sn:so:sr:st:su:sv:sy:sz:tc:td:tf:tg:th:".
"tj:tk:tm:tn:to:tp:tr:tt:tv:tw:tz:ua:ug:uk:um:us:uy:uz:va:vc:ve:".
"vg:vi:vn:vu:wf:ws:ye:yt:yu:za:zm:zr:zw:";
// The countries can have their own 'TLDs', e.g. mydomain.com.au
$cTLDs = "com:net:org:edu:gov:mil:co:ne:or:ed:go:mi:";
$fail = 0;
// Shift the address to lowercase to simplify checking
$Addr = strtolower($Addr);
// Split the Address into user and domain parts
$UD = explode("@", $Addr);
if (sizeof($UD) != 2 || !$UD[0]) $fail = 1;
// Split the domain part into its Levels
$Levels = explode(".", $UD[1]); $sLevels = sizeof($Levels);
if ($sLevels < 2) $fail = 1;
// Get the TLD, strip off trailing ] } ) > and check the length
$tld = $Levels[$sLevels-1];
$tld = ereg_replace("[>)}]$|]$", "", $tld);
if (strlen($tld) < 2 || strlen($tld) > 3 && $tld != "arpa") $fail = 1;
$Level--;
// If the string after the last dot isn't in the generic TLDs or
country codes, it's invalid.
if ($Level && !$fail) {
$Level--;
if (!ereg($tld.":", $gTLDs) && !ereg($tld.":", $CCs)) $fail = 2;
}
// If it's a country code, check for a country TLD; add on the domain name.
if ($Level && !$fail) {
$cd = $sLevels - 2; $domain = $Levels[$cd].".".$tld;
if (ereg($Levels[$cd].":", $cTLDs)) { $cd--; $domain =
$Levels[$cd].".".$domain; }
}
// See if there's an MX record for the domain
if ($Level && !$fail) {
$Level--;
if (!getmxrr($domain, $mxhosts, $weight)) $fail = 3;
}
// Attempt to connect to port 25 on an MX host
if ($Level && !$fail) {
$Level--;
while (!$sh && list($nul, $mxhost) = each($mxhosts))
$sh = fsockopen($mxhost, 25);if (!$sh) $fail = 4; } // See if anyone answers if ($Level && !$fail) { $Level--; set_socket_blocking($sh, false); $out = ""; $t = 0; while ($t++ < $Timeout && !$out)
$out = fgets($sh, 256);if (!ereg("^220", $out)) $fail = 5; } if ($sh) fclose($sh); return $fail; } // End E-Mail Validation Function ?> [/php] anyone see what might be causing the problem? -- ::Bruce::