The following code used to work in PHP 4, but it no longer works under PHP 5. Can someone take a look and let me know what needs fixing please? I'm not new to PHP, but I'm not an expert.
<?
// Set page variables.
$title = "Feedback Form";
$back = "";
$bg = '000066';
$text = 'ffffff';
$link = 'ffff00';
$vlink = 'ff0000';
$trans = 'spinoutin';
$btntag = 'text=000070 insetselection';
$txtbxtag = 'bgcolor=ffffff text=000070 cursor=ff autoactivate nohighlight';
$ip = $_SERVER['REMOTE_ADDR'];
// Remove < and > from the email message.
$msg = str_replace("<","",$msg);
$msg = str_replace(">","",$msg);
// Set email variables.
$your_email = '
[email protected]';
$your_name = 'Joe Blogs';
$your_link = 'http://www.mydomain.com/';
$confirm_sub = 'Message Sent';
$confirm_msg = "Hi $feedbackname,
Thank you for your email message sent from the $sub.
I will respond to it as quickly as I can.
Thanks again,
$your_name
$your_link";
$contact_msg = "$feedbackname ($feedbackemail) wrote:
$msg
$ip";
// Begin the sendmail routine.
if ($send) {
if (!$feedbackname || !$feedbackemail || substr_count($feedbackemail, '@') < 1 ||
substr_count($feedbackemail, '.') < 1 || !$sub || !$msg || substr_count($spam, 'clark') < 1) {
print <<<EOF
<html>
<title>Error!</title>
<body background="$back" bgcolor="$bg" text=$text link=$link
vlink=$vlink transition=$trans fontsize=medium>
<center>
<br><br>
<font s=7 c=f0><b>
Error!</b></font>
<p>
Please go back and correct the errors listed below:
<p>
<table>
<tr><td>
<ul>
EOF;
if (!$feedbackname) {
print "<li>Your name is missing!<br>"; }
if (!$feedbackemail || substr_count($feedbackemail, '@') < 1 || substr_count($feedbackemail, '.') < 1) {
print "<li>Your email is missing or invalid!<br>"; }
if (!$sub) {
print "<li>The email subject is missing!<br>"; }
if (!$msg) {
print "<li>The email message is missing!"; }
if (substr_count($spam, 'clark') < 1) {
print "You need to correctly type in the Anti-Spam word. Hit Back and try again."; }
print <<<EOF
</ul>
</table>
<p>
<A href="feedback.php">Back</A>
<br><br><br><br>
</center>
</body>
</html>
EOF;
}
else {
// Email that gets sent to you.
mail($your_email, $sub, $contact_msg, "From: $feedbackname < $feedbackemail >");
// Email that gets sent to them.
mail($feedbackemail, $confirm_sub, $confirm_msg, "From: $your_email");
// Print the thank you page.
print <<<EOF
<html>
<head><title>Message Sent</title>
</head>
<body background="$back" bgcolor="$bg" text=$text link=$link vlink=$vlink transition=$trans>
<H2>Feedback</H2>
Thanks $feedbackname for sending your message to me!<P>
You will receive a confirmation email momentarily.<P>
</body>
</html>
EOF;
}
}
else {
// Print the contact form page.
print <<<EOF
<H3>Feedback Form</H3>
To send an email to me simply fill out the form below.<P>
<form method=post>
Name: <input name=feedbackname $txtbxtag size=40><P>
Email: <input name=feedbackemail $txtbxtag size=40><P>
<INPUT type="hidden" name="sub" value="Feedback Form">
Message:<br>
<textarea name=msg rows=10 cols=50 maxlength=500
$txtbxtag></textarea><P>
<IMG SRC="images/sh-layout/turing.jpg" WIDTH="100" HEIGHT="30" BORDER="0" ALT="turing"><BR>
Anti-Spam Measure - In lowercase letters, retype the word in the image above:<BR>
<input name=spam $txtbxtag size=40><P>
<INPUT TYPE=submit NAME=send $BTNTAG VALUE="Send"><BR>
</form>
EOF;
}
?>