Jump to content

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING...


HalRau

Recommended Posts

Hello fellow phpfeaks,

 

I have been working on debugging this script for hours. I am getting this error message: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/heartl20/public_html/sendmail.php on line 58

Here is the php portion of the code with line 58 identified. I don't think that line 58 is really the offender but something in the code is. Your help for this php newbie is much appreciated. Also any suggestions on making this script better would be appreciated also.

 

<?php 
    include ('class.Date.php');  
    $oDate = new Date;  
    $sDate = $oDate->GenerateCurrentDate();  
   // print 'The time is: ' . $sTime;  
if(!isset($_POST['submit']))
{
//This page should not be accessed directly. Need to submit the form.
echo "error; you need to submit the form!";
}
$firstname = $_POST['FirstName'];
$lastname = $_POST['LastName'];
$name = $firstname." ".$lastname;
$visitor_email = $_POST['Emailadd'];
$message = $_POST['spec_request'];
$orgname = $_POST['OrgName'];
$mailaddress = $_POST['mailaddress'];
$city = $_POST['city'];
$state = $_POST['Mstate'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$ipadd = $_POST['ipadd'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
if(IsInjected($visitor_email))
{
    echo "Bad email value!";
    exit;
}

$server = "ecbiz76.inmotionhosting.com"; 
$username = "heartl20_cntacts";
$password = "HeartConts1";
$link = @mysql_connect ($server, $username, $password)
or die (mysql_error());
if (!@mysql_select_db("heartl20_contactusdb", $link)) {   
     echo "<p>There has been an error. This is the error message:</p>";
     echo "<p><strong>" . mysql_error() . "</strong></p>";
     echo "Please Contact Your Systems Administrator with the details";
}
$sql = "SELECT * FROM directemail";
$sql .= " WHERE (Rec_ID = '{$_POST['SelRecp']}')";

$result = mysql_query($sql, $link);
if (!$result) {
  echo("<p>Error performing query: " . mysql_error() . "</p>");
  exit();
}
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$Rec_ID = $row['Rec_ID'];
$FullName = $row['FullName'];
$Function = $row['Function'];
$EmailAdd = $row['EmailAdd'];
}
$email_from = '[email protected]';
$email_subject = "Contact Us Form submission";
$email_body = "$FullName, You have received an inquiry from $name \r"
    "Here is the message: \r"  //This is line 58
"$message \r"
"Additional Information: \r"
"Mailing Address: $mailaddress \r"
"$city $state, $zip \r"
"Phone: $phone \r"
"This message was sent on: $sDate From: $ipadd \r"
"Using: $httpagent ";

$to = "[email protected]";
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
mail($to,$email_subject,$email_body,$headers);
// Function to validate against any email injection attempts
function IsInjected($str)
{
  $injections = array('(\n+)',
              '(\r+)',
              '(\t+)',
              '(%0A+)',
              '(%0D+)',
              '(%08+)',
              '(%09+)'
              );
  $inject = join('|', $injections);
  $inject = "/$inject/i";
  if(preg_match($inject,$str))
    {
    return true;
  }
  else
    {
    return false;
  }
}
/* Closes Connection to the MySQL server */
mysql_close ($link);

?>



Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.