Jump to content

Unexpected Parse Error:Syntax Error Help Please


carolineelle

Recommended Posts

Hi everyone.

 

I was hoping to be able to get some help with a script for a refer a friend form. I am getting the following error.

 

 

Parse error: syntax error, unexpected '-', expecting ')' in /home/content/58/6382258/html/mime.mail.inc on line 95

 

Does anyone have any idea what the problem is? Thanks so much in advance.

 

The code is:

 

<?

 

/*

* Class mime_mail

* Original implementation by Sascha Schumann <[email protected]>

* Modified by Tobias Ratschiller <[email protected]>:

* - General code clean-up

* - separate body- and from-property

* - killed some mostly un-necessary stuff

*/

 

class mime_mail

{

var $parts;

var $to;

var $from;

var $headers;

var $subject;

var $body;

var $returnto;

 

/*

* void mime_mail()

* class constructor

*/

function mime_mail()

{

$this->parts = array();

$this->to = "";

$this->from = "";

$this->subject = "";

$this->body = "";

$this->headers = "";

$this->returnto = "";

}

 

/*

* void add_attachment(string message, [string name], [string ctype])

* Add an attachment to the mail object

*/

function add_attachment($message, $name = "", $ctype = "application/octet-stream")

{

$this->parts[] = array (

"ctype" => $ctype,

"message" => $message,

"encode" => $encode,

"name" => $name

);

}

 

/*

* void build_message(array part=

* Build message parts of an multipart mail

*/

function build_message($part)

{

$message = $part[ "message"];

$message = chunk_split(base64_encode($message));

$encoding = "base64";

return "Content-Type: ".$part[ "ctype"].

($part[ "name"]? "; name = \"".$part[ "name"]. "\"" : "").

"\nContent-Transfer-Encoding: $encoding\n\n$message\n";

}

 

/*

* void build_multipart()

* Build a multipart mail

*/

function build_multipart()

{

$boundary = "b".md5(uniqid(time()));

$multipart = "Content-Type: multipart/mixed; boundary = $boundary\n\nThis is a MIME encoded message.\n\n--$boundary";

 

for($i = sizeof($this->parts)-1; $i >= 0; $i--)

{

$multipart .= "\n".$this->build_message($this->parts[$i]). "--$boundary";

}

return $multipart.= "--\n";

}

 

/*

* void send()

* Send the mail (last class-function to be called)

*/

function send()

{

$mime = "";

if (!empty($this->from))

$mime .= "From: ".$this->from. "\n";

if (!empty($this->headers))

$mime .= $this->headers. "\n";

 

if (!empty($this->body))

$this->add_attachment($this->body, "", "text/html");

if (empty($this->return-to))

$this->returnto = $this->from;

 

$mime .= "MIME-Version: 1.0\n".$this->build_multipart();

mail($this->to, $this->subject, "", $mime, "-f".$this-returnto);

}

}; // end of class

?>

Shocking.

 

You have:

$this->return-to

 

And also:

$this->returnto

 

Then just a little further down:

$this-returnto

 

The error clearly indicates what's wrong with your code... Perhaps look at the line it advises and see if you can spot the error.

 

That code is just generally bad looking. You should really clean it up, indent your code correctly and try to make use of the curly braces.

Hi guys,

 

Thanks for replying so quickly. I actually don't have any experience with PHP and this was a free code I downloaded. After looking for a script this one seemed like the easiest to install into my site for someone who doesn't know code.

 

This forum seems like it might be for people a bit more experienced as I have looked at 'line 95' but haven't been able to spot an error. In saying that, I don't really know what I'm looking. 

 

Thanks for the advice though.

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.