]*?>.*?@si', // Strip out javascript '@]*?>.*?@siU', // Strip style tags properly '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags '@@' // Strip multi-line comments including CDATA ); $text = preg_replace($search, '', $tring); return $text; } /*function check_email_address($email) { // First, we check that there's one @ symbol, // and that the lengths are right. if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters // in one section or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%& ?'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } // Check if domain is IP. If not, // it should be valid domain name if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])| ?([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; }*/ /******************************************************************************* ** MAIN *******************************************************************************/ /* Retrieve the POST data from the form */ $keyword_ref = htmlspecialchars($_POST['referer']); $uri = htmlspecialchars($_POST['uri']); foreach ($_POST as $key => $value) { ${$key} = htmlspecialchars((stripMe($value))); } /* Verify the email address is valid */ /*if (!check_email_address($email)) {*/ /* JMK: Sugar validates email format, just leave it blank if it's bad */ /* $email = ''; } /* JMK: I took a bit of a guess at what you'd want here */ /* Fill in the Lead description */ if ($occupation == 'Nurse/PA/Healthcare' || $occupation == 'Physician') $cme = 'Yes'; else $cme = 'No'; if (!empty($keyword_ref)) $description .= 'Keyword: ' . $keyword_ref . "\n"; if (!empty($uri)) 'URI: ' . $uri . "\n"; /* Break up the name into "Salution FirstName LastName" ** Taking into account hyphens, spaces, dots and case sensitivity */ preg_match('/^(Mr|Mrs|Ms|Miss|Dr|Prof)?\.?\s*(\w*)\s*([\w\s-]*)/i', $name, $matches); switch(strtoupper($matches[1])) { case 'MR': $salutation = "Mr."; break; case 'MRS': $salutation = "Mrs."; break; case 'MS': case 'MISS': $salutation = "Ms."; break; case 'DR': $salutation = "Dr."; break; case 'PROF': $salutation = "Prof."; break; default: $salutation = ""; break; } $first_name = $matches[2]; $last_name = $matches[3]; /* Create a new LeadGeneration object to form a SOAP connection to the server */ require_once('LeadGeneration.html'); $leadGen = new LeadGeneration(); /* Setup the soap connection */ $leadGen->soapSetupConnection("http://nli.cynergyhosting.net/soap.php?wsdl"); /* Add the lead */ $leadGen->addLead($salutation, $first_name, $last_name, $phone1 . $phone2, $phone21 . $phone22, $email, $occupation, $description, $referral); ?>