Edit file File name : send.php Content :<?php /* Preventing header injection */ function cleaninjections($test) { // Remove injected headers $find = array("/bcc\:/i", "/Content\-Type\:/i", "/Mime\-Version\:/i", "/cc\:/i", "/from\:/i", "/to\:/i", "/Content\-Transfer\-Encoding\:/i"); $ret = preg_replace($find, "", $test); return $ret; } // Specify which fields to require from form $required_fields = array('name','email','phone', 'additional_info', 'company_type'); $errors = array(); $message = ""; foreach($_POST as $key => $value) { $_POST[$key] = trim($value); $_POST[$key] = cleaninjections($value); } // Check required fields and return error if blank foreach($required_fields as $value){ if(!isset($_POST[$value]) || empty($_POST[$value])){ $errors[] = "אנא מלא את כל השדות"; // message about empty fields "אנא מלא את כל השדות" } } // Validate name field. Accepts a-z, space, period for Dr., and ' for O'Malley if(isset($_POST['name']) && !empty($_POST['name'])){ if(!preg_match("/^[a-z '.]+$/i",stripslashes($_POST['name']))){ $errors[] = "שם לא חוקי"; // message about invalid name 'שם לא חוקי' } } // Validate email field if(isset($_POST['email']) && !empty($_POST['email'])){ if(!preg_match("/^[a-z0-9_.-]+@[a-z0-9.-]+.[a-z]{2,6}$/i",stripslashes($_POST['email']))){ $errors[] = "כתובת דואר אלקטרוני אינה תקינה"; /* 'כתובת דואר אלקטרוני אינה תקינה' */ /* message about incorrect email */ } } // Display any errors and exit if errors exist. if (count($errors)) { $errors = array_unique($errors); foreach ($errors as $value) { print "<li> $value</li>"; } exit; } /* Preventing header injection */ /* send email */ if (!(count($errors) > 0)) { $to = 'Lead-isracard360@isracard.co.il'; $subject = 'From the https://isracard.com'; $message = ' <html> <head> <title>Submitted from Landing Page</title> </head> <body> <p>You have new subscriber!</p> <table> <tr> <td><b>Email: </b></td> <td>'. cleaninjections(trim($_POST['email'])) .'</td> </tr> <tr> <td><b>Phone: </b></td> <td>'. cleaninjections(trim($_POST['phone'])) .'</td> </tr> <tr> <td><b>Name: </b></td> <td>'. cleaninjections(trim($_POST['name'])) .'</td> </tr> <tr> <td><b>Company Type: </b></td> <td>'. cleaninjections(trim($_POST['company_type'])) .'</td> </tr> <tr> <td><b>Additional Info: </b></td> <td>'. cleaninjections(trim($_POST['additional_info'])) .'</td> </tr> </table> </body> </html> '; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; if(!mail($to, $subject, $message,$headers)){ print "<li> Undefined Error occurred, please try again later </li>"; } } /* send email */ // // MailChimp API credentials // $apiKey = '1783794392478e33f5c738dbccb48e99-us18'; // $listID = 'c05b7dc9fa'; // // // MailChimp API URL // $memberID = hash('sha256', strtolower($_POST['email'])); // $dataCenter = substr($apiKey,strpos($apiKey,'-')+1); // $url = 'https://' . $dataCenter . '.api.mailchimp.com/3.0/lists/' . $listID . '/members/' . $memberID; // // // member information // $json = json_encode([ // 'email_address' => $_POST['email'], // 'status' => 'subscribed', // 'merge_fields' => [ // 'FNAME' => $_POST['name'], // 'PHONE_NUMB'=> $_POST['phone'], // 'ADD_INFO' => $_POST['additional_info'], // 'C_TYPE' => $_POST['company_type'], // ] // ]); // // // send a HTTP POST request with curl // $ch = curl_init($url); // curl_setopt($ch, CURLOPT_USERPWD, 'user:' . $apiKey); // curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // curl_setopt($ch, CURLOPT_TIMEOUT, 10); // curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // curl_setopt($ch, CURLOPT_POSTFIELDS, $json); // $result = curl_exec($ch); // $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); // curl_close($ch); ?>Save