Re: PHP Version 7.2
Posted: Fri May 17, 2019 8:04 pm
No, I meant the PHP code of the page : Menu -> Page -> Page HTML
WYSIWYG Web Builder
https://www.wysiwygwebbuilder.com/forum/
https://www.wysiwygwebbuilder.com/forum/viewtopic.php?t=84463
Code: Select all
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Contact Us:: Sutton-cum-Duckmanton Parish Council</title>
<meta name="author" content="Supake Ltd t: 01246 826557">
<meta name="generator" content="Supake Ltd t: 01246 826557">
<link href="SuttonCD.css" rel="stylesheet">
<link href="contactus.css" rel="stylesheet">
</head>
<body>
<div id="container">
<div id="wb_Text2" style="position:absolute;left:23px;top:301px;width:305px;height:37px;z-index:4;">
<span style="color:#2D722F;font-family:Arial;font-size:32px;"><strong>Contact Us</strong></span></div>
<div id="wb_EmbeddedPage1" style="position:absolute;left:0px;top:0px;width:840px;height:299px;z-index:5;">
<div id="wb_Image1" style="position:absolute;left:26px;top:0px;width:385px;height:299px;z-index:0;">
<img src="images/Logo.jpg" id="Image1" alt=""></div>
<img src="images/img0003.png" id="Text1" alt="Sutton-cum-Duckmanton " style="position:absolute;left:313px;top:156px;width:527px;height:50px;z-index:1;">
<img src="images/img0001.png" id="MergedObject1" alt="" title="" style="border-width:0;position:absolute;left:314px;top:216px;width:484px;height:20px;z-index:2">
<div id="wb_CssMenu1" style="position:absolute;left:310px;top:254px;width:478px;height:29px;z-index:3;">
<ul role="menubar">
<li class="firstmain"><a role="menuitem" href="./index.html" target="_self" title="Home">Home</a>
</li>
<li><a role="menuitem" href="./Reports.html" target="_self" title="Reports">Reports</a>
</li>
<li><a role="menuitem" class="active" href="./contactus.php" target="_self" title="Contact Us">Contact Us</a>
</li>
</ul>
</div>
</div>
<div id="wb_Text5" style="position:absolute;left:23px;top:1373px;width:215px;height:14px;z-index:6;">
<span style="color:#A9A9A9;font-family:Verdana;font-size:12px;"><em><a href="./contactus.php">Go to top of page</a></em></span></div>
<iframe name="ContactUsForm" id="InlineFrame1" style="position:absolute;left:190px;top:477px;width:518px;height:466px;z-index:7;" src="./sendform.php" scrolling="no"></iframe>
<div id="wb_Contact_Us_text" style="position:absolute;left:23px;top:348px;width:801px;height:90px;z-index:8;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">You can contact us via the form below. Please complete the form, click the 'Consent' check box and press 'Send'. Alternatively, you can contact the Clerk on 01246 826955 during normal office hours.<br><br>You may also be able to contact any one of the current Councillors - to view the current list, please click <a href="http://sutton-cum-duckmanton.org.uk/docs/Councillors- website.pdf" target="_blank" title="Current Councillors in PDF Format">HERE</a> (to open or download) a list in PDF format. </span></div>
</div>
</body>
</html>
Code: Select all
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>SendForm</title>
<meta name="author" content="Supake Ltd t: 01246 826557">
<meta name="generator" content="Supake Ltd t: 01246 826557">
<link href="SuttonCD.css" rel="stylesheet">
<link href="sendform.css" rel="stylesheet">
<script>
function ValidateContactUsForm()
{
var regexp;
var name = document.getElementById('name');
if (!(name.disabled || name.style.display === 'none' || name.style.visibility === 'hidden'))
{
regexp = /^[A-Za-zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f0-9-',]*$/;
if (!regexp.test(name.value))
{
alert("What is your name?");
name.focus();
return false;
}
if (name.value == "")
{
alert("What is your name?");
name.focus();
return false;
}
if (name.value.length < 3)
{
alert("What is your name?");
name.focus();
return false;
}
if (name.value.length > 100)
{
alert("What is your name?");
name.focus();
return false;
}
}
var phone = document.getElementById('phone');
if (!(phone.disabled || phone.style.display === 'none' || phone.style.visibility === 'hidden'))
{
regexp = /^[A-Za-zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f0-9-',]*$/;
if (!regexp.test(phone.value))
{
alert("What is your Phone Number");
phone.focus();
return false;
}
if (phone.value == "")
{
alert("What is your Phone Number");
phone.focus();
return false;
}
if (phone.value.length < 3)
{
alert("What is your Phone Number");
phone.focus();
return false;
}
if (phone.value.length > 50)
{
alert("What is your Phone Number");
phone.focus();
return false;
}
}
var email = document.getElementById('email');
if (!(email.disabled || email.style.display === 'none' || email.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (!regexp.test(email.value))
{
alert("What is your Email Address?");
email.focus();
return false;
}
if (email.value == "")
{
alert("What is your Email Address?");
email.focus();
return false;
}
if (email.value.length < 3)
{
alert("What is your Email Address?");
email.focus();
return false;
}
if (email.value.length > 50)
{
alert("What is your Email Address?");
email.focus();
return false;
}
}
var subject = document.getElementById('subject');
if (!(subject.disabled || subject.style.display === 'none' || subject.style.visibility === 'hidden'))
{
regexp = /^[A-Za-zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f0-9-', ?]*$/;
if (!regexp.test(subject.value))
{
alert("What is the Subject of your Query?");
subject.focus();
return false;
}
if (subject.value == "")
{
alert("What is the Subject of your Query?");
subject.focus();
return false;
}
if (subject.value.length < 3)
{
alert("What is the Subject of your Query?");
subject.focus();
return false;
}
if (subject.value.length > 50)
{
alert("What is the Subject of your Query?");
subject.focus();
return false;
}
}
var message = document.getElementById('message');
if (!(message.disabled || message.style.display === 'none' || message.style.visibility === 'hidden'))
{
regexp = /^[A-Za-zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f0-9-, . ? £]*$/;
if (!regexp.test(message.value))
{
alert("What is your message?");
message.focus();
return false;
}
if (message.value == "")
{
alert("What is your message?");
message.focus();
return false;
}
if (message.value.length < 3)
{
alert("What is your message?");
message.focus();
return false;
}
if (message.value.length > 250)
{
alert("What is your message?");
message.focus();
return false;
}
}
return true;
}
</script>
</head>
<body>
<div id="wb_contactusForm1" style="position:absolute;left:1px;top:0px;width:471px;height:433px;z-index:15;">
<form name="ContactUsForm" method="post" action="sentform.php" id="contactusForm1" onsubmit="return ValidateContactUsForm()">
<input type="text" id="name" style="position:absolute;left:126px;top:18px;width:335px;height:20px;z-index:0;" name="name" value="" maxlength="100" tabindex="10" spellcheck="false" title="What is your name?" placeholder="Your Preferred Contact Name">
<label for="contactusForm1" id="contactusLabel1" style="position:absolute;left:19px;top:12px;width:68px;height:35px;line-height:35px;z-index:1;" tabindex="0">Name *</label>
<input type="text" id="phone" style="position:absolute;left:126px;top:55px;width:335px;height:20px;z-index:2;" name="phone" value="" maxlength="100" tabindex="20" spellcheck="false" title="What is your Phone Number?" placeholder="A number can we call you on if needed">
<label for="contactusLabel1" id="contactusLabel2" style="position:absolute;left:19px;top:49px;width:68px;height:35px;line-height:35px;z-index:3;" tabindex="0">Phone *</label>
<input type="text" id="email" style="position:absolute;left:126px;top:92px;width:335px;height:20px;z-index:4;" name="email" value="" maxlength="100" tabindex="30" spellcheck="false" title="What is your Email Address?" placeholder="Your Preferred Email Address">
<label for="contactusLabel2" id="contactusLabel3" style="position:absolute;left:19px;top:86px;width:68px;height:35px;line-height:35px;z-index:5;">Email *</label>
<input type="text" id="subject" style="position:absolute;left:126px;top:129px;width:335px;height:20px;z-index:6;" name="subject" value="" maxlength="100" tabindex="40" spellcheck="false" title="What is the Subject of your Query?" placeholder="What do you want to contact us about?">
<label for="contactusLabel3" id="contactusLabel4" style="position:absolute;left:19px;top:122px;width:84px;height:35px;line-height:35px;z-index:7;">Subject *</label>
<label for="contactusLabel4" id="contactusLabel5" style="position:absolute;left:19px;top:234px;width:94px;height:35px;line-height:35px;z-index:8;">Message *</label>
<textarea name="message" id="message" style="position:absolute;left:126px;top:173px;width:335px;height:146px;z-index:9;" rows="7" cols="40" tabindex="50" spellcheck="false" title="Your Message" placeholder="Your Message up to a maximum of 250 characters. Some charactes are not allowed, if you cannot send your message please remove any special characters, eg ! ? @ # and so on, then try again."></textarea>
<label for="" id="contactusLabel6" style="position:absolute;left:121px;top:384px;width:330px;height:20px;line-height:20px;z-index:10;" title="(* All fields are required)">(* All fields are required)</label>
<input type="submit" id="contactusButton1" name="Send" value="Send" style="position:absolute;left:363px;top:386px;width:96px;height:25px;z-index:11;" title="Send your Query!">
<div id="wb_permission" style="position:absolute;left:126px;top:339px;width:33px;height:27px;z-index:12;">
<input type="checkbox" id="permission" name="permission" value="Permisson has been given to Contact this person." style="position:absolute;left:0;top:0;" title="Can we contact you if needed?"><label for="permission"></label></div>
<div id="wb_Text1" style="position:absolute;left:158px;top:345px;width:308px;height:36px;z-index:13;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Consent - can we contact you if needed?</span></div>
<div id="wb_Text2" style="position:absolute;left:19px;top:403px;width:55px;height:10px;z-index:14;">
<span style="color:#696969;font-family:Verdana;font-size:8px;">v1.15</span></div>
</form>
</div>
</body>
</html>
Code: Select all
<?php
// All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS.
ini_set("sendmail_from", " clerk@sutton-cum-duckmanton.org.uk ");
// $permission = $_POST['permission'];
// $name = $_POST['name'];
// $phone = $_POST['phone'];
// $email = $_POST['email'];
// $subject = $_POST['subject'];
// $message = $_POST['message'];
$thetimestamp = date("Y-m-d H:i:s");
// $EmailBody = "A Message from the S-c-D Web siteContact-Us \n\n";
// $EmailBody .= "On " .$thetimestamp ." this message was sent by " .$name ." as follows:" ."\n\n";
// $EmailBody .= "My Telephone number: " .$phone ."\n";
// $EmailBody .= "My Contact Email Address: " .$email ."\n\n";
// $EmailBody .= "My Message is:\n\n" .$message;
// $EmailBody .= "\n\n========== End of Message ==========\n\n";
// $EmailBody .= "[This email has been processed by the Supake Auto-Mailing System]";
// Get Status of Permission Box - and add msg if needed.
// Validate and send the message
$to = "info@supake.co.uk";
$subject = "a subject";
$emailBody = "hello world";
$headers = "From: clerk@sutton-cum-duckmanton.org.uk";
mail($to,$subject,$emailBody,$headers);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>sentform</title>
<meta name="author" content="Supake Ltd t: 01246 826557">
<meta name="generator" content="Supake Ltd t: 01246 826557">
<link href="SuttonCD.css" rel="stylesheet">
<link href="sentform.css" rel="stylesheet">
</head>
<body>
<div id="wb_Image1" style="position:absolute;left:4px;top:2px;width:365px;height:283px;z-index:0;">
<img src="images/Logo.jpg" id="Image1" alt=""></div>
<div id="wb_Text1" style="position:absolute;left:21px;top:320px;width:445px;height:36px;text-align:center;z-index:1;">
<span style="color:#4F4F4F;font-family:Verdana;font-size:15px;">Your Message has been processed and sent. We will be in touch as soon as we can. Thank you for your interest.</span></div>
<img src="images/img0002.png" id="Text2" alt="Thank You " style="position:absolute;left:226px;top:194px;width:221px;height:50px;z-index:2;">
</body>
</html>
Code: Select all
<?php
function ValidateEmail($email)
{
$pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i';
return preg_match($pattern, $email);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['formid']) && $_POST['formid'] == 'contactusform1')
{
$mailto = 'clerk@sutton-cum-duckmanton.org.uk';
$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
$subject = 'Web Page Contact Us Form';
$message = 'A Message from the ScD Contact Us Form as follows:
';
$success_url = './sentform.php';
$error_url = './sentform.php';
$error = '';
$eol = "\n";
$boundary = md5(uniqid(time()));
$header = 'From: '.$mailfrom.$eol;
$header .= 'Reply-To: '.$mailfrom.$eol;
$header .= 'MIME-Version: 1.0'.$eol;
$header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol;
$header .= 'X-Mailer: PHP v'.phpversion().$eol;
if (!ValidateEmail($mailfrom))
{
$error .= "The specified email address is invalid!\n<br>";
}
if (!empty($error))
{
$errorcode = file_get_contents($error_url);
$replace = "##error##";
$errorcode = str_replace($replace, $error, $errorcode);
echo $errorcode;
exit;
}
$internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response");
$message .= $eol;
$logdata = '';
foreach ($_POST as $key => $value)
{
if (!in_array(strtolower($key), $internalfields))
{
if (!is_array($value))
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol;
}
else
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol;
}
}
}
$body = 'This is a multi-part message in MIME format.'.$eol.$eol;
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol;
$body .= 'Content-Transfer-Encoding: 8bit'.$eol;
$body .= $eol.stripslashes($message).$eol;
if (!empty($_FILES))
{
foreach ($_FILES as $key => $value)
{
if ($_FILES[$key]['error'] == 0)
{
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol;
$body .= 'Content-Transfer-Encoding: base64'.$eol;
$body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol;
$body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol;
}
}
}
$body .= '--'.$boundary.'--'.$eol;
if ($mailto != '')
{
mail($mailto, $subject, $body, $header);
}
header('Location: '.$success_url);
exit;
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>SendForm</title>
<meta name="author" content="Supake Ltd t: 01246 826557">
<meta name="generator" content="Supake Ltd t: 01246 826557 - using a mix of technologies to get you results!">
<link href="SuttonCD.css" rel="stylesheet">
<link href="sendform.css" rel="stylesheet">
<script>
function ValidateContactUsForm()
{
var regexp;
var name = document.getElementById('name');
if (!(name.disabled || name.style.display === 'none' || name.style.visibility === 'hidden'))
{
regexp = /^[A-Za-zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f0-9-',]*$/;
if (!regexp.test(name.value))
{
alert("What is your name?");
name.focus();
return false;
}
if (name.value == "")
{
alert("What is your name?");
name.focus();
return false;
}
if (name.value.length < 3)
{
alert("What is your name?");
name.focus();
return false;
}
if (name.value.length > 100)
{
alert("What is your name?");
name.focus();
return false;
}
}
var phone = document.getElementById('phone');
if (!(phone.disabled || phone.style.display === 'none' || phone.style.visibility === 'hidden'))
{
regexp = /^[A-Za-zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f0-9-',]*$/;
if (!regexp.test(phone.value))
{
alert("What is your Phone Number");
phone.focus();
return false;
}
if (phone.value == "")
{
alert("What is your Phone Number");
phone.focus();
return false;
}
if (phone.value.length < 3)
{
alert("What is your Phone Number");
phone.focus();
return false;
}
if (phone.value.length > 50)
{
alert("What is your Phone Number");
phone.focus();
return false;
}
}
var email = document.getElementById('email');
if (!(email.disabled || email.style.display === 'none' || email.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (!regexp.test(email.value))
{
alert("What is your Email Address?");
email.focus();
return false;
}
if (email.value == "")
{
alert("What is your Email Address?");
email.focus();
return false;
}
if (email.value.length < 3)
{
alert("What is your Email Address?");
email.focus();
return false;
}
if (email.value.length > 50)
{
alert("What is your Email Address?");
email.focus();
return false;
}
}
var subject = document.getElementById('subject');
if (!(subject.disabled || subject.style.display === 'none' || subject.style.visibility === 'hidden'))
{
regexp = /^[A-Za-zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f0-9-', ?]*$/;
if (!regexp.test(subject.value))
{
alert("What is the Subject of your Query?");
subject.focus();
return false;
}
if (subject.value == "")
{
alert("What is the Subject of your Query?");
subject.focus();
return false;
}
if (subject.value.length < 3)
{
alert("What is the Subject of your Query?");
subject.focus();
return false;
}
if (subject.value.length > 50)
{
alert("What is the Subject of your Query?");
subject.focus();
return false;
}
}
var message = document.getElementById('message');
if (!(message.disabled || message.style.display === 'none' || message.style.visibility === 'hidden'))
{
regexp = /^[A-Za-zÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f0-9-, . ? £]*$/;
if (!regexp.test(message.value))
{
alert("What is your message?");
message.focus();
return false;
}
if (message.value == "")
{
alert("What is your message?");
message.focus();
return false;
}
if (message.value.length < 3)
{
alert("What is your message?");
message.focus();
return false;
}
if (message.value.length > 250)
{
alert("What is your message?");
message.focus();
return false;
}
}
return true;
}
</script>
</head>
<body>
<div id="wb_contactusForm1" style="position:absolute;left:1px;top:0px;width:471px;height:433px;z-index:15;">
<form name="ContactUsForm" method="post" action="<?php echo basename(__FILE__); ?>" enctype="multipart/form-data" id="contactusForm1" onsubmit="return ValidateContactUsForm()">
<input type="hidden" name="formid" value="contactusform1">
<input type="text" id="name" style="position:absolute;left:126px;top:18px;width:335px;height:20px;z-index:0;" name="name" value="" maxlength="100" tabindex="10" spellcheck="false" title="What is your name?" placeholder="Your Preferred Contact Name">
<label for="contactusForm1" id="contactusLabel1" style="position:absolute;left:19px;top:12px;width:68px;height:35px;line-height:35px;z-index:1;" tabindex="0">Name *</label>
<input type="text" id="phone" style="position:absolute;left:126px;top:55px;width:335px;height:20px;z-index:2;" name="phone" value="" maxlength="100" tabindex="20" spellcheck="false" title="What is your Phone Number?" placeholder="A number can we call you on if needed">
<label for="contactusLabel1" id="contactusLabel2" style="position:absolute;left:19px;top:49px;width:68px;height:35px;line-height:35px;z-index:3;" tabindex="0">Phone *</label>
<input type="text" id="email" style="position:absolute;left:126px;top:92px;width:335px;height:20px;z-index:4;" name="email" value="" maxlength="100" tabindex="30" spellcheck="false" title="What is your Email Address?" placeholder="Your Preferred Email Address">
<label for="contactusLabel2" id="contactusLabel3" style="position:absolute;left:19px;top:86px;width:68px;height:35px;line-height:35px;z-index:5;">Email *</label>
<input type="text" id="subject" style="position:absolute;left:126px;top:129px;width:335px;height:20px;z-index:6;" name="subject" value="" maxlength="100" tabindex="40" spellcheck="false" title="What is the Subject of your Query?" placeholder="What do you want to contact us about?">
<label for="contactusLabel3" id="contactusLabel4" style="position:absolute;left:19px;top:122px;width:84px;height:35px;line-height:35px;z-index:7;">Subject *</label>
<label for="contactusLabel4" id="contactusLabel5" style="position:absolute;left:19px;top:234px;width:94px;height:35px;line-height:35px;z-index:8;">Message *</label>
<textarea name="message" id="message" style="position:absolute;left:126px;top:173px;width:335px;height:146px;z-index:9;" rows="7" cols="40" tabindex="50" spellcheck="false" title="Your Message" placeholder="Your Message up to a maximum of 250 characters. Some charactes are not allowed, if you cannot send your message please remove any special characters, eg ! ? @ # and so on, then try again."></textarea>
<label for="" id="contactusLabel6" style="position:absolute;left:121px;top:384px;width:330px;height:20px;line-height:20px;z-index:10;" title="(* All fields are required)">(* All fields are required)</label>
<input type="submit" id="contactusButton1" name="Send" value="Send" style="position:absolute;left:363px;top:386px;width:96px;height:25px;z-index:11;" title="Send your Query!">
<div id="wb_permission" style="position:absolute;left:126px;top:339px;width:33px;height:27px;z-index:12;">
<input type="checkbox" id="permission" name="permission" value="Permisson has been given to Contact this person." style="position:absolute;left:0;top:0;" title="Can we contact you if needed?"><label for="permission"></label></div>
<div id="wb_Text1" style="position:absolute;left:158px;top:345px;width:308px;height:36px;z-index:13;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Consent - can we contact you if needed?</span></div>
<div id="wb_Text2" style="position:absolute;left:19px;top:403px;width:55px;height:10px;z-index:14;">
<span style="color:#696969;font-family:Verdana;font-size:8px;">v1.15</span></div>
</form>
</div>
</body>
</html>
Code: Select all
<?php
// ini_set("sendmail_from", "info@supake.co.uk");
ini_set("sendmail_from", "xxxxx@yyyyy.zzzzz");
$thevariables = $_POST['thevariables'];
$from = $_POST['from'];
$to = $_POST['to'];
$Subject = "Variable testing";
$EmailBody = "Variable tests - the body - " ."\n\n" ."External Domain Used" ."\n\n" .$thevariables ."\n\n";
$EmailBody .= "FROM FIELD Specified was: " .$from ."\n\n";
$EmailBody .= "TO FIELD Specified was: " .$to;
// $Headers = "From: info@supake.co.uk";
$Headers = "From: " .$from;
mail($to,$Subject,$EmailBody,$Headers);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Page</title>
<link href="PHPMailIssues.css" rel="stylesheet">
<link href="showvars2.css" rel="stylesheet">
</head>
<body>
<div id="wb_Text1" style="position:absolute;left:27px;top:28px;width:900px;height:54px;z-index:0;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Nothing to see here - the email has been sent using PHP and not the built-in form.<br><br>NOTE: '$To' and '$FROM' are variably coded to an email address taken from the form.</span></div>
</body>
</html>
Code: Select all
<?php
function ValidateEmail($email)
{
$pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i';
return preg_match($pattern, $email);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['formid']) && $_POST['formid'] == 'form1')
{
$mailto = 'info@supake.co.uk';
$mailfrom = 'info@supake.co.uk';
$subject = 'Test Bog Standard';
$message = 'Values submitted from web site form:';
$success_url = '#';
$error_url = '#';
$error = '';
$eol = "\n";
$boundary = md5(uniqid(time()));
$header = 'From: '.$mailfrom.$eol;
$header .= 'Reply-To: '.$mailfrom.$eol;
$header .= 'MIME-Version: 1.0'.$eol;
$header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol;
$header .= 'X-Mailer: PHP v'.phpversion().$eol;
if (!ValidateEmail($mailfrom))
{
$error .= "The specified email address is invalid!\n<br>";
}
if (!empty($error))
{
$errorcode = file_get_contents($error_url);
$replace = "##error##";
$errorcode = str_replace($replace, $error, $errorcode);
echo $errorcode;
exit;
}
$internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response");
$message .= $eol;
$logdata = '';
foreach ($_POST as $key => $value)
{
if (!in_array(strtolower($key), $internalfields))
{
if (!is_array($value))
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol;
}
else
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol;
}
}
}
$body = 'This is a multi-part message in MIME format.'.$eol.$eol;
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol;
$body .= 'Content-Transfer-Encoding: 8bit'.$eol;
$body .= $eol.stripslashes($message).$eol;
if (!empty($_FILES))
{
foreach ($_FILES as $key => $value)
{
if ($_FILES[$key]['error'] == 0)
{
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol;
$body .= 'Content-Transfer-Encoding: base64'.$eol;
$body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol;
$body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol;
}
}
}
$body .= '--'.$boundary.'--'.$eol;
if ($mailto != '')
{
mail($mailto, $subject, $body, $header);
}
header('Location: '.$success_url);
exit;
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>bogstandardemail</title>
<link href="PHPMailIssues.css" rel="stylesheet">
<link href="index.css" rel="stylesheet">
<script>
function ValidatebogstandardmailForm()
{
var regexp;
var Editbox1 = document.getElementById('Editbox1');
if (!(Editbox1.disabled || Editbox1.style.display === 'none' || Editbox1.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (Editbox1.value.length != 0 && !regexp.test(Editbox1.value))
{
alert("Please enter a valid email address.");
Editbox1.focus();
return false;
}
}
var Editbox2 = document.getElementById('Editbox2');
if (!(Editbox2.disabled || Editbox2.style.display === 'none' || Editbox2.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (Editbox2.value.length != 0 && !regexp.test(Editbox2.value))
{
alert("Please enter a valid email address.");
Editbox2.focus();
return false;
}
}
return true;
}
</script>
<script>
function ValidatebogstandardmailForm()
{
var regexp;
var Editbox7 = document.getElementById('Editbox7');
if (!(Editbox7.disabled || Editbox7.style.display === 'none' || Editbox7.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (Editbox7.value.length != 0 && !regexp.test(Editbox7.value))
{
alert("Please enter a valid email address.");
Editbox7.focus();
return false;
}
}
var Editbox8 = document.getElementById('Editbox8');
if (!(Editbox8.disabled || Editbox8.style.display === 'none' || Editbox8.style.visibility === 'hidden'))
{
regexp = /^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i;
if (Editbox8.value.length != 0 && !regexp.test(Editbox8.value))
{
alert("Please enter a valid email address.");
Editbox8.focus();
return false;
}
}
return true;
}
</script>
</head>
<body>
<div id="wb_Form1" style="position:absolute;left:51px;top:22px;width:447px;height:193px;z-index:15;">
<form name="bogstandardmailForm" method="post" action="<?php echo basename(__FILE__); ?>" enctype="multipart/form-data" id="Form1" onsubmit="return ValidatebogstandardmailForm()">
<input type="hidden" name="formid" value="form1">
<input type="text" id="Editbox1" style="position:absolute;left:189px;top:17px;width:216px;height:18px;z-index:0;" name="from" value="" spellcheck="false">
<div id="wb_Text1" style="position:absolute;left:71px;top:22px;width:56px;height:18px;z-index:1;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">From</span></div>
<div id="wb_Text2" style="position:absolute;left:71px;top:61px;width:56px;height:18px;z-index:2;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">To</span></div>
<div id="wb_Text3" style="position:absolute;left:71px;top:95px;width:90px;height:18px;z-index:3;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Message</span></div>
<input type="text" id="Editbox2" style="position:absolute;left:189px;top:56px;width:216px;height:18px;z-index:4;" name="to" value="" spellcheck="false">
<input type="text" id="Editbox3" style="position:absolute;left:189px;top:95px;width:216px;height:18px;z-index:5;" name="message" value="Hello World - Auto Form" spellcheck="false">
<input type="submit" id="Button1" name="Send" value="Submit" style="position:absolute;left:312px;top:139px;width:96px;height:25px;z-index:6;">
</form>
</div>
<div id="wb_Text4" style="position:absolute;left:641px;top:164px;width:124px;height:18px;z-index:16;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">V1.17</span></div>
<div id="wb_Text9" style="position:absolute;left:540px;top:65px;width:249px;height:54px;z-index:17;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Note the <strong>From </strong>and <strong>To </strong>not used here as the Built-in code has that defined</span></div>
<div id="wb_Text11" style="position:absolute;left:548px;top:365px;width:249px;height:72px;z-index:18;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Note the<strong> Built-In form </strong>is <strong>not </strong>used here as the php code is used to process the form data and sends it to showvars2.php</span></div>
<div id="wb_Form3" style="position:absolute;left:51px;top:244px;width:447px;height:312px;z-index:19;">
<form name="bogstandardmailForm" method="post" action="showvars2.php" id="Form3" onsubmit="return ValidatebogstandardmailForm()">
<div id="wb_Text12" style="position:absolute;left:37px;top:40px;width:335px;height:18px;z-index:7;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Variables to send (some text):</span></div>
<input type="submit" id="Button3" name="Send" value="Submit" style="position:absolute;left:319px;top:236px;width:96px;height:25px;z-index:8;">
<input type="text" id="Editbox7" style="position:absolute;left:182px;top:87px;width:216px;height:18px;z-index:9;" name="from" value="" spellcheck="false">
<div id="wb_Text13" style="position:absolute;left:51px;top:141px;width:97px;height:18px;z-index:10;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">To</span></div>
<div id="wb_Text14" style="position:absolute;left:44px;top:87px;width:56px;height:18px;z-index:11;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">From</span></div>
<input type="text" id="Editbox8" style="position:absolute;left:182px;top:136px;width:216px;height:18px;z-index:12;" name="to" value="" spellcheck="false">
<input type="text" id="Editbox9" style="position:absolute;left:182px;top:188px;width:216px;height:18px;z-index:13;" name="thevariables" value="Hello World - PHP Coded" spellcheck="false">
<div id="wb_Text15" style="position:absolute;left:51px;top:193px;width:90px;height:18px;z-index:14;">
<span style="color:#000000;font-family:Verdana;font-size:15px;">Message</span></div>
</form>
</div>
</body>
</html>
work. Also, are you able to send to and from a selection of email addresses using the form (to eliminate security issues)? Cheers// ini_set("sendmail_from", "info@supake.co.uk");
Code: Select all
ini_set("sendmail_from", "clerk@sutton-cum-duckmanton.org.uk");
Do you get the same error if you use another email address?Update: I have noticed that I can only send from (to anywhere) Fasthosts based email adders to there is some check going on...
Line 18 being: mail($to,$Subject,$EmailBody,$Headers);PHPWarning: mail(): SMTP server response: 554 5.7.1 <info@supake.co.uk>: Recipient address rejected: Access denied in \\HP3-WINC2-SMB2.HOSTINGP3.LOCAL\DOMAINSZ\952\1944952\user\htdocs\bogstandardmail\showvars2.php on line 18
Yes, it does!No, not really.
, with a ? mark, I thought you were asking me. In any case, as I can either use 'hand coded' or 'PHP Mailer' for built-in forms, it's a win-win for me. Many thanks for your help and patience and as always, a top service. Thanks.So, this confirm that it's a server issue?