[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Problem adding script

Posted on 2008-02-01
2
Medium Priority
?
177 Views
Last Modified: 2010-08-05
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/registration/captcha_inc.php on line 19

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>";
 
}
?>

Open in new window

0
Comment
Question by:pertrai1
  • 2
2 Comments
 
LVL 4

Expert Comment

by:almilyo
ID: 20798931
replace

|| ($_FILES["file"]["type"] == "image/tiff"))

with

|| ($_FILES["file"]["type"] == "image/tiff"))

in line 17 of your source code listing.
0
 
LVL 4

Accepted Solution

by:
almilyo earned 2000 total points
ID: 20798934
oops! I mean replace it with

|| ($_FILES["file"]["type"] == "image/tiff")
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question