Signup form randomly not working.

I have been asked to fix a sign up form. My PHP ability is quite limited. The form did work but has randomly stopped. I don’t think it has been changed. It worked from 2 forms on one page in a flash site. Could somebody help me understand if something is wrong with it and if it should be working, and where I am going wrong. Thank you.

Here is the code, I hope someone can help:

<?php if( isset($_POST['name']) && isset($_POST['email']) ){ if( validate_name($_POST['name']) && validate_email($_POST['email']) ){ $params['to'] = "[email protected]"; $params['from'] = "Funky Friend <".$_POST['email'].">"; $params['subject'] = " Funky Chicks have a new Funky Friend! "; $params['content'] = "Hey Funky Chick! A new funky friend has signed up! See them below: \r\n Name: ". $_POST['name'] ." \r\n Email: ".$_POST['email']." "; if( isset($_POST['compEntry']) ) { $params['subject'] = " Funky Competition Entry! "; $params['content'] = "Hey Funky Chick! \n\r Competition Entry below: \r\n Name: ". $_POST['name'] ." \r\n Email: ".$_POST['email']." "; } sendEmail($params); echo "pass: successfully added"; } else { return "fail: not valid"; } } else { return "fail: all entered"; } function validate_name($name){ return true; } function validate_email($email) { if(eregi("^[a-zA-Z0-9_\.][email protected][a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email)) { return TRUE; } else { return FALSE; } list($Username, $Domain) = split("@",$email); $MXHost = null; if(getmxrr($Domain, $MXHost)) { return TRUE; } else { if(fsockopen($Domain, 25, $errno, $errstr, 30)) { return TRUE; } else { return FALSE; } } } function sendEmail($params) { // Email Addresses $to = "[email protected]";//$params['to']; $from = $params['from']; // Email Subject $subject = $params['subject']; // Email Content $content = $params['content']; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; if (isset($from)) $headers .= "From: " . $from . "\r\n"; $headers .= "Bcc: [email protected]" . "\r\n"; mail($to, $subject, nl2br($content), $headers); } ?>
Sponsor our Newsletter | Privacy Policy | Terms of Service