@
xARGONx @
Jason
The browser doesn't handle php code, the server does. And <? does work like <?php provided that short_open_tag or w/e is set to true.
Also, this works without problems over here (cleaned up with npp), what errors do you get?:
[highlight=php]
<?php
// URL:
Free Contact Form scripts, email forms. FreeContactForm.com
// Version: FreeContactForm Lite V1.1
// Copyright (c) 2010 Stuart Cochrane <stuartc1@
gmail.com>
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
if(isset($_REQUEST['Email_Address'])) {
include 'lite_settings.php';
if($email_to == 'youremailaddress@
yourdomain.com') {
die('This message is for the Webmaster. Please enter your email address into the file "lite_settings.php"');
}
function died($error) {
echo 'Sorry, but there were error(s) found with the form you submitted. ';
echo 'These errors appear below.<br /><br />';
echo $error.'<br /><br />';
echo 'Please go back and fix these errors.<br /><br />';
die();
}
if(!isset($_REQUEST['Full_Name']) ||
!isset($_REQUEST['Email_Address']) ||
// !isset($_REQUEST['Telephone_Number']) || not required?
!isset($_REQUEST['Your_Message'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$full_name = $_REQUEST['Full_Name']; // required
$email_from = $_REQUEST['Email_Address']; // required
$telephone = $_REQUEST['Telephone_Number']; // not required
$comments = $_REQUEST['Your_Message']; // required
$error_message = '';
if(!preg_match('/^[[:alnum:]-_.]+@[[:alnum:]-_.]+\.[a-z]{2,4}$/i', $email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
if(strlen($full_name) < 2) {
$error_message .= 'Your Name does not appear to be valid.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = 'Form details below.'."\r\n";
function clean_string($string) {
$bad = array('content-type', 'bc:', 'to:', 'cc:', 'href');
return str_replace($bad, '', $string);
}
$email_message .= 'Full Name: '.clean_string($full_name)."\r\n";
$email_message .= 'Email: '.clean_string($email_from)."\r\n";
$email_message .= 'Telephone: '.clean_string($telephone)."\r\n";
$email_message .= 'Message: '.clean_string($comments)."\r\n";
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@
Mail($email_to, $email_subject, $email_message, $headers);
header('Location: '.$thankyou);
}
?>
[/highlight]
PS: fml, REQUEST should be POST, I cbf to send post values so I just used get
