1

I uploaded this form page to my web server and it gives this error:" Parse error: syntax error, unexpected '{' in /nfs/c02/h05/mnt/28472/domains/aurorainnovations.org/html/SS/form_data.php on line 1"

This only happens on web server, on my local host everything works fine and loads correctly.

-Here is my code relative to the error.

<?php
if(isset($_POST['submit']))
{
  require_once('recaptchalib.php');
  $privatekey = "6LcwTP0SAAAAAIkWtjMa26s4Fsu8VICktkrP7ble";
  $resp = recaptcha_check_answer ($privatekey,$_SERVER["REMOTE_ADDR"],$_POST["recaptcha_challenge_field"],$_POST["recaptcha_response_field"]);

  if (!$resp->is_valid) {

    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {






$your_email ='austin@aurorainnovations.com,samplerequest@aurorainnovations.com';

session_start();
$errors = '';
$name = 'Sample Request';
$email = '';
    $how = $_POST['how-did-you-hear-about'];
    $soilbrand = $_POST['soilbrand'];
    $hydrobrand = $_POST['hydrobrand'];
    $organic = $_POST['full-partial-syntheticsonly-grower'];
    $localstore = $_POST['what-store-doyou-purchase'];
    $currentbrand = $_POST['what-brand-of-nutrients-use'];
    $productrequest = $_POST['productrequest'];
    $newproducts = $_POST['where-do-you-find-new-products'];
    $email = $_POST['email'];
    $shipto = $_POST['shipto'];


    if(empty($name)||empty($email))
    {
        $errors .= "\n Name and Email are required fields. ";    
    }

    if(empty($errors))
    {

        $to = $your_email;
        $subject="Sample Request";
        $from = $email;
        $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';

        $body = "The Following sample request was submitted\n\n".
        "1.  HOW DID YOU HEAR ABOUT AURORA INNOVATIONS?\n".
        "$how\n\n".
        "2.  WHAT BRAND OF SOIL DO YOU USE?\n".
        "$soilbrand\n\n".
        "3.  IF YOU GROW HYDROPONICALLY WHAT TYPE AND BRAND OF MEDIA DO YOU USE?\n ".
        "$hydrobrand\n\n".
        "4.  ARE YOU A 100% ORGANIC GROWER, PARTIAL ORGANIC GROWER OR SYNTHETICS ONLY?\n".
        "$organic\n\n".
        "5.  WHAT STORE DO YOU PURCHASE GARDENING SUPPLIES AT?\n".
        "$localstore\n\n".
        "6.  WHAT BRAND OF NUTRIENTS DO YOU CURRENTLY USE?\n".
        "$currentbrand\n\n".
        "7.  IS THERE A SPECIFIC AURORA PRODUCT SAMPLE YOU WOULD LIKE TO TRY?\n".
        "$productrequest\n\n".
        "8.  WHERE DO YOU FIND NEW PRODUCTS TO TRY?\n".
        "$newproducts\n\n".
        "9.  PLEASE PROVIDE YOUR EMAIL ADDRESS.\n".
        "$email\n\n".
        "10.  PLEASE PROVIDE YOUR SHIPPING ADDRESS.\n".
        "$shipto\n\n".
        "11.This request was sent from the following IP Address. Note this to prevent scammers!\n". 
        "IP: $ip\n";    

        $headers = "From: $from \r\n";
        $headers .= "Reply-To: $visitor_email \r\n";

        mail($to, $subject, $body,$headers);

        header('Location: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UADAYLDTGP4SE');
    }
  }

function IsInjected($str)
{
  $injections = array('(\n+)',
              '(\r+)',
              '(\t+)',
              '(%0A+)',
              '(%0D+)',
              '(%08+)',
              '(%09+)'
              );
  $inject = join('|', $injections);
  $inject = "/$inject/i";
  if(preg_match($inject,$str))
    {
    return true;
  }
  else
    {
    return false;
  }
  }
}

 ?>
  • 1
    welp, because your brackets are out of whack. Try formatting things in your text editor the way they should be and you'll spot the error :) – Steve's a D Nov 12 '14 at 21:38
  • I have done That with no luck. – Sam_in_real_life Nov 12 '14 at 22:12
  • Your code example is very long. Try to make a simple version of your code: and gradually move more and more of your code into the file on the server. When you get your syntax error you have found the error. If the above code in my example gives an error, it not in the code you have to look. – Anders Finn Jørgensen Nov 12 '14 at 22:36

0 Answers0