johnnybananas
12-17-2005, 12:10 AM
I am trying to get the following email script to work but keep getting the following message...
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/public_html/water_folder/subscribe.php on line 12
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Email Sign-up</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body><?php
$referer = "somedomain.com";
if (getenv("REQUEST_METHOD") == "GET"){
echo "You may only use this script using the ""POST"" method";
exit;
}
if (!(preg_match("/$referer/i", "$HTTP_REFERER"))){
echo "You are accessing this script from an unauthorized domain.";
exit;
}
else {
$checkpoint = ereg("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,3}$",$email);
if($checkpoint==0) {
// if no valid email address entered, display no email message
echo "You <b>must</b> specify a valid email address. <a href=javascript:history.back(-1)>Return to the form</a>.";
}
else {
mail("someemail@yahoo.com", "Guest", $message, "From: $email");
echo "Congratulations. Your Email was sent successfully."; // if all went well, thank user
}
}
?>
<form action="" method="post">
Your email: <input name="email" type="text" size="20" maxlength="200" value="enter your email address">
<input type="submit" name="submit" value="Sign up">
</form>
</body>
</html>
Any suggestions please?
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/public_html/water_folder/subscribe.php on line 12
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Email Sign-up</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body><?php
$referer = "somedomain.com";
if (getenv("REQUEST_METHOD") == "GET"){
echo "You may only use this script using the ""POST"" method";
exit;
}
if (!(preg_match("/$referer/i", "$HTTP_REFERER"))){
echo "You are accessing this script from an unauthorized domain.";
exit;
}
else {
$checkpoint = ereg("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,3}$",$email);
if($checkpoint==0) {
// if no valid email address entered, display no email message
echo "You <b>must</b> specify a valid email address. <a href=javascript:history.back(-1)>Return to the form</a>.";
}
else {
mail("someemail@yahoo.com", "Guest", $message, "From: $email");
echo "Congratulations. Your Email was sent successfully."; // if all went well, thank user
}
}
?>
<form action="" method="post">
Your email: <input name="email" type="text" size="20" maxlength="200" value="enter your email address">
<input type="submit" name="submit" value="Sign up">
</form>
</body>
</html>
Any suggestions please?