oliverkazaam41
08-07-2007, 04:17 PM
I inherited this website from our former IT person I am having problem making this work. I am getting this error
"PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in on line 153"
Could someone please check on the codes. Thank you in advance.
Start
<?PHP
$formtype = $_POST['formtype'];
$Comment = $_POST['Comment'];
$Phone = $_POST['Phone'];
$Email = $_POST['Email'];
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Street1 = $_POST['Street1'];
$Street2 = $_POST['Street2'];
$City = $_POST['City'];
$State = $_POST['State'];
$Zip = $_POST['Zip'];
$Country = $_POST['Country'];
include "http://www.lighthouseprophecy.com/cgi-bin/constants.inc";
$LHP = "webmaster@lighthouseprophecy.com,contact@lighthouseprophecy.com";
$ID = time(); // date( "Y-m-d" ) $today = date("D M j G:i:s T Y"); Sat Mar 10 15:16:08 MST 2001
$Date = date( "M-j-Y " );
$Comment = str_replace("\n"," ",$Comment);
$Comment = str_replace("\r"," ",$Comment);
$Comment = trim($Comment);
$Comment = $formtype . " " . $Comment;
$OutString = "$formtype\t$ID\t$Comment\t$FirstName\t$LastName\t$Street1\t$Street2\t$City\t$State\t$Zip\t$Country\t $Email\t$Phone \n";
$Name = $FirstName . " " . $LastName;
$errors = array();
if($_SERVER['REQUEST_METHOD'] == "POST"){$form_input = $_POST;}elseif($_SERVER['REQUEST_METHOD'] == "GET"){$form_input = $_GET;}else{exit;}
// Remove leading whitespace from all values.
function recursive_array_check(&$element_value)
{
if(!is_array($element_value)){$element_value = ltrim($element_value);}
else
{
foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check($value);}
}
return $element_value;
}
recursive_array_check($form_input);
// Check referrer is from same site.
if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}
// Strip HTML tags from all fields.
function recursive_array_check2(&$element_value)
{
if(!is_array($element_value)){$element_value = strip_tags($element_value);}
else {
foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check2($value);}
}
return $element_value;
}
recursive_array_check2($form_input);
// Validate FirstName field.
if(isset($form_input['FirstName']) && !empty($form_input['FirstName']))
{
if(preg_match("`[\r\n]`",$form_input['FirstName'])){$errors[] = "You have submitted an invalid new line character";}
if(preg_match("/[^a-z' -]/i",stripslashes($form_input['FirstName']))){$errors[] = "You have submitted an invalid character in the frist name field";}
}
// Validate LastName field.
if(isset($form_input['LastName']) && !empty($form_input['LastName']))
{
if(preg_match("`[\r\n]`",$form_input['LastName'])){$errors[] = "You have submitted an invalid new line character";}
if(preg_match("/[^a-z' -]/i",stripslashes($form_input['FirstName']))){$errors[] = "You have submitted an invalid character in the last name field";}
}
// Validate Phone field.
if(isset($form_input['Phone']) && !empty($form_input['Phone']))
{
if(preg_match("`[\r\n]`",$form_input['Phone'])){$errors[] = "You have submitted an invalid new line character";}
// if(preg_match("/[^a-z' -]/i",stripslashes($form_input['FirstName']))){$errors[] = "You have submitted an invalid character in the phone field";}
}
// Validate Street1 field.
if(isset($form_input['Street1']) && !empty($form_input['Street1']))
{
if(preg_match("`[\r\n]`",$form_input['Street1'])){$errors[] = "You have submitted an invalid new line character";}
}
// Validate Street2 field.
if(isset($form_input['Street2']) && !empty($form_input['Street2']))
{
if(preg_match("`[\r\n]`",$form_input['Street2'])){$errors[] = "You have submitted an invalid new line character";}
}
// Validate City field.
if(isset($form_input['City']) && !empty($form_input['City']))
{
if(preg_match("`[\r\n]`",$form_input['City'])){$errors[] = "You have submitted an invalid new line character";}
}
// Validate email field.
if(isset($form_input['Email']) && !empty($form_input['Email']))
{
if(preg_match("`[\r\n]`",$form_input['Email'])){$errors[] = "You have submitted an invalid new line character";}
if(!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-z]{2,4}$/i',$form_input['Email'])){$errors[] = "Email address is invalid";}
}
// Display any errors and exit if errors exist.
if(count($errors)){foreach($errors as $value){print "$value<br>";}
exit;}
// Home Church
if ($formtype == HC) {
// autoresponder
$message = "Dear " . $FirstName . ", \n\n Thank you for visiting LightHouseProphecy.com and sending us your Home-Church submission. \n Please be aware that by making your submission, you have given us permission to list your information on our website. \n\n\n God bless you, \n\n Clay Sikes \n";
$message = stripslashes($message);
$subject = "Home-Church submission " . $ID;
$headers = "From: " . $form_input['LHP'] . "\n" . "Return-Path: " . $form_input['LPH'] . "\n" . "Reply-To: " . $form_input['LPH'] . "\n";
mail($Email,$subject,$message,$headers);
// send to Clay
$message = "From: " . $FirstName . " \n\n Comment: " . $Comment . "\n\n Contact Information: \n\n" . $Name . "\n" . $Email . "\n" . $Phone . " \n\n" . $Street1 . " " . $Street2 "\n" . $City . " " . $State . " " . $Zip . " \n\n";
$message = stripslashes($message);
$subject = "Home-Church submission " . $ID;
$headers = "From: " . $form_input['Email'] . "\n" . "Return-Path: " . $form_input['Email'] . "\n" . "Reply-To: " . $form_input['Email'] . "\n";
mail($LHP,$subject,$message,$headers);
}
// Praise Report
if ($formtype == S) {
// autoresponder
$message = "Dear " . $FirstName . ", \n\n Thank you for visiting LightHouseProphecy.com and sending us your praise report. \n\n\n God bless you, \n\n Clay Sikes \n";
$message = stripslashes($message);
$subject = "Praise Report! " . $ID;
$headers = "From: " . $form_input['LHP'] . "\n" . "Return-Path: " . $form_input['LPH'] . "\n" . "Reply-To: " . $form_input['LPH'] . "\n";
mail($Email,$subject,$message,$headers);
// send to Clay
$message = "From: " . $FirstName . " \n\n Comment: " . $Comment . "\n\n Contact Information: \n\n" . $Name . "\n" . $Email . "\n" . $Phone . " \n\n" . $Street1 . " " . $Street2 "\n" . $City . " " . $State . " " . $Zip . " \n\n";
$message = stripslashes($message);
$subject = "Praise Report! " . $ID;
$headers = "From: " . $form_input['Email'] . "\n" . "Return-Path: " . $form_input['Email'] . "\n" . "Reply-To: " . $form_input['Email'] . "\n";
mail($LHP,$subject,$message,$headers);
}
// 'Prophecy' type of contact
if ($formtype == P) {
$message = "Dear " . $FirstName . ", \n\n Thank you for visiting LightHouseProphecy.com, we enjoy hearing from you. \n This email is your confirmation that we have received the following message from you. \n\n" . $Comment . "\n\n Our contact information for you is: \n" . $Name . " " . $Email . " " . $Phone . " \n\n We appreciate your communication with LHP. \n\n\n\n Clay Sikes \n";
$message = stripslashes($message);
$subject = "Submitted Word " . $ID;
$headers = "From: " . $form_input['LHP'] . "\n" . "Return-Path: " . $form_input['LPH'] . "\n" . "Reply-To: " . $form_input['LPH'] . "\n";
mail($Email,$subject,$message,$headers);
// send to Clay
$message = "From: " . $FirstName . " \n\n Comment: " . $Comment . "\n\n Contact Information: \n\n" . $Name . "\n" . $Email . "\n" . $Phone . " \n\n" . $Street1 . " " . $Street2 "\n" . $City . " " . $State . " " . $Zip . " \n\n";
$message = stripslashes($message);
$subject = "Submitted Prophecy or Word! " . $ID;
$headers = "From: " . $form_input['Email'] . "\n" . "Return-Path: " . $form_input['Email'] . "\n" . "Reply-To: " . $form_input['Email'] . "\n";
mail($LHP,$subject,$message,$headers);
}
// 'Other' type of contact
if ($formtype == O) {
$message = "Dear " . $FirstName . ", \n\n Thank you for visiting LightHouseProphecy.com, we enjoy hearing from you. \n This email is your confirmation that we have received the following message from you. \n\n" . $Comment . "\n\n Our contact information for you is: \n" . $Name . " " . $Email . " " . $Phone . " \n\n We appreciate your communication with LHP. \n\n\n\n Clay Sikes \n";
$message = stripslashes($message);
$subject = "You selected Other ;-) " . $ID;
$headers = "From: " . $form_input['LHP'] . "\n" . "Return-Path: " . $form_input['LPH'] . "\n" . "Reply-To: " . $form_input['LPH'] . "\n";
mail($Email,$subject,$message,$headers);
// send to Clay
$message = "From: " . $FirstName . " \n\n Comment: " . $Comment . "\n\n Contact Information: \n\n" . $Name . "\n" . $Email . "\n" . $Phone . " \n\n" . $Street1 . " " . $Street2 "\n" . $City . " " . $State . " " . $Zip . " \n\n";
$message = stripslashes($message);
$subject = "Other Communication from LHP site! " . $ID;
$headers = "From: " . $form_input['Email'] . "\n" . "Return-Path: " . $form_input['Email'] . "\n" . "Reply-To: " . $form_input['Email'] . "\n";
mail($LHP,$subject,$message,$headers);
}
?>
end
"PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in on line 153"
Could someone please check on the codes. Thank you in advance.
Start
<?PHP
$formtype = $_POST['formtype'];
$Comment = $_POST['Comment'];
$Phone = $_POST['Phone'];
$Email = $_POST['Email'];
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Street1 = $_POST['Street1'];
$Street2 = $_POST['Street2'];
$City = $_POST['City'];
$State = $_POST['State'];
$Zip = $_POST['Zip'];
$Country = $_POST['Country'];
include "http://www.lighthouseprophecy.com/cgi-bin/constants.inc";
$LHP = "webmaster@lighthouseprophecy.com,contact@lighthouseprophecy.com";
$ID = time(); // date( "Y-m-d" ) $today = date("D M j G:i:s T Y"); Sat Mar 10 15:16:08 MST 2001
$Date = date( "M-j-Y " );
$Comment = str_replace("\n"," ",$Comment);
$Comment = str_replace("\r"," ",$Comment);
$Comment = trim($Comment);
$Comment = $formtype . " " . $Comment;
$OutString = "$formtype\t$ID\t$Comment\t$FirstName\t$LastName\t$Street1\t$Street2\t$City\t$State\t$Zip\t$Country\t $Email\t$Phone \n";
$Name = $FirstName . " " . $LastName;
$errors = array();
if($_SERVER['REQUEST_METHOD'] == "POST"){$form_input = $_POST;}elseif($_SERVER['REQUEST_METHOD'] == "GET"){$form_input = $_GET;}else{exit;}
// Remove leading whitespace from all values.
function recursive_array_check(&$element_value)
{
if(!is_array($element_value)){$element_value = ltrim($element_value);}
else
{
foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check($value);}
}
return $element_value;
}
recursive_array_check($form_input);
// Check referrer is from same site.
if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}
// Strip HTML tags from all fields.
function recursive_array_check2(&$element_value)
{
if(!is_array($element_value)){$element_value = strip_tags($element_value);}
else {
foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check2($value);}
}
return $element_value;
}
recursive_array_check2($form_input);
// Validate FirstName field.
if(isset($form_input['FirstName']) && !empty($form_input['FirstName']))
{
if(preg_match("`[\r\n]`",$form_input['FirstName'])){$errors[] = "You have submitted an invalid new line character";}
if(preg_match("/[^a-z' -]/i",stripslashes($form_input['FirstName']))){$errors[] = "You have submitted an invalid character in the frist name field";}
}
// Validate LastName field.
if(isset($form_input['LastName']) && !empty($form_input['LastName']))
{
if(preg_match("`[\r\n]`",$form_input['LastName'])){$errors[] = "You have submitted an invalid new line character";}
if(preg_match("/[^a-z' -]/i",stripslashes($form_input['FirstName']))){$errors[] = "You have submitted an invalid character in the last name field";}
}
// Validate Phone field.
if(isset($form_input['Phone']) && !empty($form_input['Phone']))
{
if(preg_match("`[\r\n]`",$form_input['Phone'])){$errors[] = "You have submitted an invalid new line character";}
// if(preg_match("/[^a-z' -]/i",stripslashes($form_input['FirstName']))){$errors[] = "You have submitted an invalid character in the phone field";}
}
// Validate Street1 field.
if(isset($form_input['Street1']) && !empty($form_input['Street1']))
{
if(preg_match("`[\r\n]`",$form_input['Street1'])){$errors[] = "You have submitted an invalid new line character";}
}
// Validate Street2 field.
if(isset($form_input['Street2']) && !empty($form_input['Street2']))
{
if(preg_match("`[\r\n]`",$form_input['Street2'])){$errors[] = "You have submitted an invalid new line character";}
}
// Validate City field.
if(isset($form_input['City']) && !empty($form_input['City']))
{
if(preg_match("`[\r\n]`",$form_input['City'])){$errors[] = "You have submitted an invalid new line character";}
}
// Validate email field.
if(isset($form_input['Email']) && !empty($form_input['Email']))
{
if(preg_match("`[\r\n]`",$form_input['Email'])){$errors[] = "You have submitted an invalid new line character";}
if(!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-z]{2,4}$/i',$form_input['Email'])){$errors[] = "Email address is invalid";}
}
// Display any errors and exit if errors exist.
if(count($errors)){foreach($errors as $value){print "$value<br>";}
exit;}
// Home Church
if ($formtype == HC) {
// autoresponder
$message = "Dear " . $FirstName . ", \n\n Thank you for visiting LightHouseProphecy.com and sending us your Home-Church submission. \n Please be aware that by making your submission, you have given us permission to list your information on our website. \n\n\n God bless you, \n\n Clay Sikes \n";
$message = stripslashes($message);
$subject = "Home-Church submission " . $ID;
$headers = "From: " . $form_input['LHP'] . "\n" . "Return-Path: " . $form_input['LPH'] . "\n" . "Reply-To: " . $form_input['LPH'] . "\n";
mail($Email,$subject,$message,$headers);
// send to Clay
$message = "From: " . $FirstName . " \n\n Comment: " . $Comment . "\n\n Contact Information: \n\n" . $Name . "\n" . $Email . "\n" . $Phone . " \n\n" . $Street1 . " " . $Street2 "\n" . $City . " " . $State . " " . $Zip . " \n\n";
$message = stripslashes($message);
$subject = "Home-Church submission " . $ID;
$headers = "From: " . $form_input['Email'] . "\n" . "Return-Path: " . $form_input['Email'] . "\n" . "Reply-To: " . $form_input['Email'] . "\n";
mail($LHP,$subject,$message,$headers);
}
// Praise Report
if ($formtype == S) {
// autoresponder
$message = "Dear " . $FirstName . ", \n\n Thank you for visiting LightHouseProphecy.com and sending us your praise report. \n\n\n God bless you, \n\n Clay Sikes \n";
$message = stripslashes($message);
$subject = "Praise Report! " . $ID;
$headers = "From: " . $form_input['LHP'] . "\n" . "Return-Path: " . $form_input['LPH'] . "\n" . "Reply-To: " . $form_input['LPH'] . "\n";
mail($Email,$subject,$message,$headers);
// send to Clay
$message = "From: " . $FirstName . " \n\n Comment: " . $Comment . "\n\n Contact Information: \n\n" . $Name . "\n" . $Email . "\n" . $Phone . " \n\n" . $Street1 . " " . $Street2 "\n" . $City . " " . $State . " " . $Zip . " \n\n";
$message = stripslashes($message);
$subject = "Praise Report! " . $ID;
$headers = "From: " . $form_input['Email'] . "\n" . "Return-Path: " . $form_input['Email'] . "\n" . "Reply-To: " . $form_input['Email'] . "\n";
mail($LHP,$subject,$message,$headers);
}
// 'Prophecy' type of contact
if ($formtype == P) {
$message = "Dear " . $FirstName . ", \n\n Thank you for visiting LightHouseProphecy.com, we enjoy hearing from you. \n This email is your confirmation that we have received the following message from you. \n\n" . $Comment . "\n\n Our contact information for you is: \n" . $Name . " " . $Email . " " . $Phone . " \n\n We appreciate your communication with LHP. \n\n\n\n Clay Sikes \n";
$message = stripslashes($message);
$subject = "Submitted Word " . $ID;
$headers = "From: " . $form_input['LHP'] . "\n" . "Return-Path: " . $form_input['LPH'] . "\n" . "Reply-To: " . $form_input['LPH'] . "\n";
mail($Email,$subject,$message,$headers);
// send to Clay
$message = "From: " . $FirstName . " \n\n Comment: " . $Comment . "\n\n Contact Information: \n\n" . $Name . "\n" . $Email . "\n" . $Phone . " \n\n" . $Street1 . " " . $Street2 "\n" . $City . " " . $State . " " . $Zip . " \n\n";
$message = stripslashes($message);
$subject = "Submitted Prophecy or Word! " . $ID;
$headers = "From: " . $form_input['Email'] . "\n" . "Return-Path: " . $form_input['Email'] . "\n" . "Reply-To: " . $form_input['Email'] . "\n";
mail($LHP,$subject,$message,$headers);
}
// 'Other' type of contact
if ($formtype == O) {
$message = "Dear " . $FirstName . ", \n\n Thank you for visiting LightHouseProphecy.com, we enjoy hearing from you. \n This email is your confirmation that we have received the following message from you. \n\n" . $Comment . "\n\n Our contact information for you is: \n" . $Name . " " . $Email . " " . $Phone . " \n\n We appreciate your communication with LHP. \n\n\n\n Clay Sikes \n";
$message = stripslashes($message);
$subject = "You selected Other ;-) " . $ID;
$headers = "From: " . $form_input['LHP'] . "\n" . "Return-Path: " . $form_input['LPH'] . "\n" . "Reply-To: " . $form_input['LPH'] . "\n";
mail($Email,$subject,$message,$headers);
// send to Clay
$message = "From: " . $FirstName . " \n\n Comment: " . $Comment . "\n\n Contact Information: \n\n" . $Name . "\n" . $Email . "\n" . $Phone . " \n\n" . $Street1 . " " . $Street2 "\n" . $City . " " . $State . " " . $Zip . " \n\n";
$message = stripslashes($message);
$subject = "Other Communication from LHP site! " . $ID;
$headers = "From: " . $form_input['Email'] . "\n" . "Return-Path: " . $form_input['Email'] . "\n" . "Reply-To: " . $form_input['Email'] . "\n";
mail($LHP,$subject,$message,$headers);
}
?>
end