pertrai1
asked on
Problem adding script
Hi all, I am not good at PHP and all I pretty much do is copy script and paste. I have this script below that does a captcha check for a form and send it to me. I have just added a piece of script to upload a picture from my form. The problem is when I copy and paste the piece of script I get an error. Below is the script and here is the error I get:
Parse error: syntax error, unexpected T_BOOLEAN_AND in /home/equinere/public_html /stallions /registrat ion/captch a_inc.php on line 19
Thanks for all of your expert help.
Rob
Parse error: syntax error, unexpected T_BOOLEAN_AND in /home/equinere/public_html
Thanks for all of your expert help.
Rob
<?
// *** The CAPTCHA comparison - http://frikk.tk ***
// *** further modifications - http://www.captcha.biz ***
session_start();
// *** We need to make sure theyre coming from a posted form -
// If not, quit now ***
if ($_SERVER["REQUEST_METHOD"] <> "POST")
die("You can only reach this page by posting from the html form");
// *** The text input will come in through the variable $_POST["captcha_input"],
// while the correct answer is stored in the cookie $_COOKIE["pass"] ***
if ($_POST["captcha_input"] == $_SESSION["pass"])
{
if ((($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/tiff"))
|| ($_FILES["file"]["type"] == "image/x-tiff"))
&& ($_FILES["file"]["size"] < 20000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"../upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
// *** They passed the test! ***
// *** This is where you would post a comment to your database, etc ***
echo "Thank you " . $_POST["name"] ." for your inquiry. We will contact you via phone or email shortly.<br><br>";
//echo "You information input has been sent <br><br>";
//echo "This is what you sent to us <br><br>";
//echo "Your Name: " . $_POST["name"] . " <br>";
//echo "Your eMail: " . $_POST["email"] . " <br>";
//echo "Your Address: " . $_POST["address"] . " <br>";
//echo "Your City: " . $_POST["city"] . " <br>";
//echo "Your State: " . $_POST["state"] . " <br>";
//echo "Your Zip: " . $_POST["zip"] . " <br>";
//echo "Your Home Phone Number: " . $_POST["hphone"] . " <br>";
//echo "Your Work Phone Number: " . $_POST["wphone"] . " <br>";
//echo "Your Fax Number: " . $_POST["fax"] . " <br>";
//echo "Your eMail: " . $_POST["email"] . " <br>";
//echo "Details: " . $_POST["notes"] . " <br>";
//echo "<br>";
//echo "Services you are interested in:<br>";
//echo " \"" . $_POST["program"] . "\" <br>";
//echo " \"" . $_POST["ai"] . "\" <br>";
//echo " \"" . $_POST["cem"] . "\" <br>";
//echo " \"" . $_POST["cooled"] . "\" <br>";
//echo " \"" . $_POST["embryo"] . "\" <br>";
//echo " \"" . $_POST["foaling"] . "\" <br>";
//echo " \"" . $_POST["mini"] . "\" <br>";
//echo " \"" . $_POST["onfarm"] . "\" <br>";
//echo " \"" . $_POST["phantom"] . "\" <br>";
//echo " \"" . $_POST["problem"] . "\" <br>";
//echo " \"" . $_POST["reproeval"] . "\" <br>";
//echo " \"" . $_POST["freezing"] . "\" <br>";
//echo " \"" . $_POST["standing"] . "\" <br>";
//echo " \"" . $_POST["externship"] . "\" <br>";
//echo " \"" . $_POST["subfertility"] . "\" <br>";
//echo " \"" . $_POST["internship"] . "\" <br>";
//sends email via php to the following address
$mailuser = "rob@simpsonequine.com";
$replyuser = $_POST['email'];
$replyname = $_POST['name'];
//echo 'default chosen address: '.$mailuser;
$header = "Return-Path: ".$mailuser."\r\n";
$header .= "From: ".$replyname." <".$replyuser.">\r\n";
$header .= "Content-Type: text/html;";
$interests ="";
$list = $_POST['interests'];
foreach($list as $k => $v)
$interests .= $v . "<br />\n";
$mail_body = '
'. $_POST[name] . ' has submitted this information from the Equine Reproduction Concepts website. <br><br>
Name: '. $_POST[name] . '<br>
email: '. $_POST[email] . '<br>
Address: '. $_POST[address] . '<br>
City: '. $_POST[city] . '<br>
State: '. $_POST[state] . '<br>
Zip Code: '. $_POST[zip] . '<br>
Home Phone Number: '. $_POST[hphone] . '<br>
Work Phone Number: '. $_POST[wphone] . '<br>
Fax Number: '. $_POST[fax] . '<br>
Comments/Questions: '. $_POST[notes] . '<br><br>'. ($interests!="" ?'
Interests: All of the below were checked as services '. $_POST[name] . ' has interest in.<br> '. $interests : '');
mail ($mailuser, 'ERC Contact Submission', $mail_body, $header);
echo 'Thank you for visiting the \'Equine Reproduction Concepts\' website. ';
} else {
// *** The input text did not match the stored text, so they failed ***
// *** You would probably not want to include the correct answer, but
// unless someone is trying on purpose to circumvent you specifically,
// its not a big deal. If someone is trying to circumvent you, then
// you should probably use a more secure way besides storing the
// info in a cookie that always has the same name! :) ***
echo "Sorry, you did not pass the CAPTCHA test.<br><br>";
echo "You said " . $_POST["captcha_input"];
echo " while the correct answer was " . $_SESSION["pass"];
echo " - Please click back in your browser and try again <br><br>";
}
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
|| ($_FILES["file"]["type"] == "image/tiff"))
with
|| ($_FILES["file"]["type"] == "image/tiff"))
in line 17 of your source code listing.