Can't figure it out

A

Anonymous

Guest
I have been trying to figure out where this error is coming from and I cannot. The error is Parse error: parse error, unexpected $ in /home/users/dev/public_html/mmrentals/email_mmrpass.php on line 215

The code is long, sorry but here it is:

Code:
<?php

session_start();

//site_defines
$SECURED_PAGE = 'mmr_login.php?reason=1';

// If the form was submited check if the username and password match
if($_POST['submitid'] == 2){
$username = $_POST["username"];
$dbconn = mysql_connect (localhost, dev_mmr, mmr)
or die('I cannot connect to the database because: ' . mysql_error() );
mysql_select_db(dev_mmrentals, $dbconn);

$result = mysql_query("SELECT * from mmr_users WHERE username='$username'");

$row = mysql_fetch_array($result);

/* recipients */
$to1  = $row['email'];
/* email */
$email1 = $_post['email'];
/* subject */
$subject1 = $_post['subject'];
/* message */
$html_message.= "<html><head></head><body>
$html_message.= "<table width=100%  border=0 cellpadding=0 cellspacing=0 bgcolor=#6F390A><tr><td align=center valign=top>";
$html_message.= "<table width=500 border=0 cellpadding=0 cellspacing=0 bgcolor=#FFFFFF><tr>";
$html_message.= "<td width=500 colspan=2><img src=http://www.dev.chattanoogawebsites.com/mmrentals/images/email_logo.jpg width=500 height=137></td>";
$html_message.= "</tr><tr><td valign=top height=300>";
$html_message.= "<table border=0 cellpadding=0 cellspacing=0><tr><td valign=top width=486 align=center>";
$html_message.= "<table width=100% border=0 cellspacing=3 cellpadding=0 style=font-family: arial;><tr><td rowspan=6>";
$html_message.= "<img src=http://www.dev.chattanoogawebsites.com/mmrentals/images/copper.gif width=174 height=130 hspace=0 border=0 vspace=0>";
$html_message.= "</td></tr><td height=100 colspan=2 align=center>";
$html_message.= "<b>Forgot Your Password</b></td></tr>";
$html_message.= "<tr><td colspan=2 align=center>";
$html_message.= "Your password was requested by someone attemping to access the employee area of the"; 
$html_message.= "website. Please note that this email address is the only way to access your password.";
$html_message.= "<p>";
$html_message.= "Your password is <b><i>".$row['password']."</i></b>"; 
$html_message.= "<p>";
$html_message.= "Please put it in a secure area.";
$html_message.= "</td></tr>";
$html_message.= "<tr><td height=20>";
$html_message.= "</td></tr>";
$html_message.= "<tr><td>";
$html_message.= "<img src=http://www.dev.chattanoogawebsites.com/mmrentals/images/gus_sign.gif height=47 width=316>";
$html_message.= "</td></tr>";
$html_message.= "</table>";
$html_message.= "</td></tr>";
$html_message.= "</table>";
$html_message.= "</td><td width=14 rowspan=2>
$html_message.= "<img src=http://www.dev.chattanoogawebsites.com/mmrentals/images/side_shadow.gif width=14 height=613 border=0 hspace=0 vspace=0>";
$html_message.= "</td></tr>";
$html_message.= "<tr><td valign=bottom align=center style=ont-family:arial;font-size:7pt;>";				
$html_message.= "Designed, Developed, and Maintained by <a href=http://www.chattanoogawwebsites.com>ChattanoogaWebSites.com</a>";
$html_message.= "</td></tr>";		
$html_message.= "</table>";
$html_message.= "</td></tr>";
$html_message.= "</table>";
$html_message.= "</body></html>";
/* To send HTML mail, you can set the Content-type header. */
$headers1  = "MIME-Version: 1.0\r\n";
$headers1 .= "Content-type: text/html; charset=iso-8859-1\r\n";

/* additional headers */
$headers1 .= "From: ".$email1."\r\n";
$headers1 .= "Reply-To: ".$email1."\r\n";
$headers1 .= "Cc: \r\n";


/* and now mail it */
if(mail($to1, $subject1, $html_message, $headers1)){
  header("Location: $SECURED_PAGE");
		exit();
} else {
$message = 'There was an error in the send engine. Please try again later.';
}
?>

There is also additional html code under this code that I won't take up space with, but the line number is the error is the last line of HTML on the page.

Can anybody help?

TIA
roliver
 
I corrected that line and another that I found. I had tried to make the number of lines of code a little smaller and had not checked all the lines. Sorry about that, however, I am still getting the same error, just on another line number, because I shortened the number of lines in the code. Any other ideas?

roliver
 
Code:
<?php

session_start();

//site_defines
$SECURED_PAGE = 'mmr_login.php?reason=1';

// If the form was submited check if the username and password match
if($_POST['submitid'] == 2){
$username = $_POST['username'];
$dbconn = mysql_connect ('localhost', 'dev_mmr', 'mmr')
or die('I cannot connect to the database because: ' . mysql_error() );
mysql_select_db('dev_mmrentals', $dbconn);

$result = mysql_query("SELECT * from mmr_users WHERE username='$username'");

$row = mysql_fetch_array($result);

/* recipients */
$to1 = $row['email'];
/* email */
$email1 = $_POST['email'];
/* subject */
$subject1 = $_POST['subject'];
/* message */
$html_message.= '<html><head></head><body>';
$html_message.= '<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#6F390A"><tr><td align="center" valign="top">';
$html_message.= '<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"><tr>';
$html_message.= '<td width="500" colspan="2"><img src="http://www.dev.chattanoogawebsites.com/mmrentals/images/email_logo.jpg" width="500" height="137"></td>';
$html_message.= '</tr><tr><td valign="top" height="300">';
$html_message.= '<table border="0" cellpadding="0" cellspacing="0"><tr><td valign="top" width="486" align="center">';
$html_message.= '<table width="100%" border="0" cellspacing="3" cellpadding="0" style="font-family: arial;"><tr><td rowspan="6">';
$html_message.= '<img src="http://www.dev.chattanoogawebsites.com/mmrentals/images/copper.gif" width="174" height="130" hspace="0" border="0" vspace="0">';
$html_message.= '</td></tr><td height="100" colspan="2" align="center">';
$html_message.= '<b>Forgot Your Password</b></td></tr>';
$html_message.= '<tr><td colspan="2" align="center">';
$html_message.= 'Your password was requested by someone attemping to access the employee area of the';
$html_message.= 'website. Please note that this email address is the only way to access your password.';
$html_message.= '<p>'
$html_message.= 'Your password is <b><i>'.$row['password'].'</i></b>';
$html_message.= '<p>';
$html_message.= 'Please put it in a secure area.';
$html_message.= '</td></tr>';
$html_message.= '<tr><td height="20">';
$html_message.= '</td></tr>';
$html_message.= '<tr><td>';
$html_message.= '<img src="http://www.dev.chattanoogawebsites.com/mmrentals/images/gus_sign.gif" height="47" width="316">';
$html_message.= '</td></tr>';
$html_message.= '</table>';
$html_message.= '</td></tr>';
$html_message.= '</table>';
$html_message.= '</td><td width="14" rowspan="2">';
$html_message.= '<img src="http://www.dev.chattanoogawebsites.com/mmrentals/images/side_shadow.gif" width="14" height="613" border="0" hspace="0" vspace="0">';
$html_message.= '</td></tr>';
$html_message.= '<tr><td valign="bottom" align="center" style="ont-family:arial;font-size:7pt;">';
$html_message.= 'Designed, Developed, and Maintained by <a href="http://www.chattanoogawwebsites.com">ChattanoogaWebSites.com</a>';
$html_message.= '</td></tr>';
$html_message.= '</table>';
$html_message.= '</td></tr>';
$html_message.= '</table>';
$html_message.= '</body></html>';
/* To send HTML mail, you can set the Content-type header. */
$headers1 = "MIME-Version: 1.0\r\n";
$headers1 .= "Content-type: text/html; charset=iso-8859-1\r\n";

/* additional headers */
$headers1 .= 'From: '.$email1."\r\n";
$headers1 .= 'Reply-To: '.$email1."\r\n";
$headers1 .= "Cc: \r\n";


/* and now mail it */
if(mail($to1, $subject1, $html_message, $headers1)){
header("Location: $SECURED_PAGE");
exit();
} else {
$message = 'There was an error in the send engine. Please try again later.';
}
?>
 
$html_message.= 'website. Please note that this email address is the only way to access your password.';
$html_message.= '<p>';

What do you write your code in? You can get programs which check these for you you know.
 
Oops - my mistake something else as well.

Code:
<?php

session_start();

//site_defines
$SECURED_PAGE = 'mmr_login.php?reason=1';

// If the form was submited check if the username and password match
if($_POST['submitid'] == 2){
	$username = $_POST['username'];
	$dbconn = mysql_connect ('localhost', 'dev_mmr', 'mmr')
	or die('I cannot connect to the database because: ' . mysql_error() );
	mysql_select_db('dev_mmrentals', $dbconn);

	$result = mysql_query("SELECT * from mmr_users WHERE username='$username'");

	$row = mysql_fetch_array($result);

	/* recipients */
	$to1 = $row['email'];
	/* email */
	$email1 = $_POST['email'];
	/* subject */
	$subject1 = $_POST['subject'];
	/* message */
	$html_message.= '<html><head></head><body>';
	$html_message.= '<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#6F390A"><tr><td align="center" valign="top">';
	$html_message.= '<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"><tr>';
	$html_message.= '<td width="500" colspan="2"><img src="http://www.dev.chattanoogawebsites.com/mmrentals/images/email_logo.jpg" width="500" height="137"></td>';
	$html_message.= '</tr><tr><td valign="top" height="300">';
	$html_message.= '<table border="0" cellpadding="0" cellspacing="0"><tr><td valign="top" width="486" align="center">';
	$html_message.= '<table width="100%" border="0" cellspacing="3" cellpadding="0" style="font-family: arial;"><tr><td rowspan="6">';
	$html_message.= '<img src="http://www.dev.chattanoogawebsites.com/mmrentals/images/copper.gif" width="174" height="130" hspace="0" border="0" vspace="0">';
	$html_message.= '</td></tr><td height="100" colspan="2" align="center">';
	$html_message.= '<b>Forgot Your Password</b></td></tr>';
	$html_message.= '<tr><td colspan="2" align="center">';
	$html_message.= 'Your password was requested by someone attemping to access the employee area of the';
	$html_message.= 'website. Please note that this email address is the only way to access your password.';
	$html_message.= '<p>'
	$html_message.= 'Your password is <b><i>'.$row['password'].'</i></b>';
	$html_message.= '<p>';
	$html_message.= 'Please put it in a secure area.';
	$html_message.= '</td></tr>';
	$html_message.= '<tr><td height="20">';
	$html_message.= '</td></tr>';
	$html_message.= '<tr><td>';
	$html_message.= '<img src="http://www.dev.chattanoogawebsites.com/mmrentals/images/gus_sign.gif" height="47" width="316">';
	$html_message.= '</td></tr>';
	$html_message.= '</table>';
	$html_message.= '</td></tr>';
	$html_message.= '</table>';
	$html_message.= '</td><td width="14" rowspan="2">';
	$html_message.= '<img src="http://www.dev.chattanoogawebsites.com/mmrentals/images/side_shadow.gif" width="14" height="613" border="0" hspace="0" vspace="0">';
	$html_message.= '</td></tr>';
	$html_message.= '<tr><td valign="bottom" align="center" style="ont-family:arial;font-size:7pt;">';
	$html_message.= 'Designed, Developed, and Maintained by <a href="http://www.chattanoogawwebsites.com">ChattanoogaWebSites.com</a>';
	$html_message.= '</td></tr>';
	$html_message.= '</table>';
	$html_message.= '</td></tr>';
	$html_message.= '</table>';
	$html_message.= '</body></html>';
	/* To send HTML mail, you can set the Content-type header. */
	$headers1 = "MIME-Version: 1.0\r\n";
	$headers1 .= "Content-type: text/html; charset=iso-8859-1\r\n";

	/* additional headers */
	$headers1 .= 'From: '.$email1."\r\n";
	$headers1 .= 'Reply-To: '.$email1."\r\n";
	$headers1 .= "Cc: \r\n";


	/* and now mail it */
	if(mail($to1, $subject1, $html_message, $headers1)){
		header("Location: $SECURED_PAGE");
		exit();
	} else {
		$message = 'There was an error in the send engine. Please try again later.';
	}
}
?>

Just missing a semicolon and a curly bracket
 
It was the bottom bracket that did the trick. I can't believe that I missed that! I am using an HTML editor called HTML Kit. Is there a good PHP editor out there that is not too expensive? I really appreciate you guys help.


roliver
 
Have a look at the first post in this forum... it goes about php editors.
 
I know im a pain in the ass when it comes to Editors.. ZEND :D hihi -- sorry, just couldnt hold myself... its not expensive, just a bit less then $500 for a professional version...

Hmmz... some people start wondering about me having any connection to Zend itself :p i will not tell ^^
 
Zend is nice, but expensive. There are plenty of free ones too, look in that thread in this forum.

Will.
 
Going :eek:fftopic: but i did not find ANY that will be as good... and trus me: ive looked throught tons.. aybe even all of them... free ones really suck...
and you dont have to buy a pro version, i think there is a standard that costs about $300 or somthing... and THATS cheap.. I think 500 is pretty cheap as well for such an IDE
 
Back
Top