Jump to content


Photo

Parse error: parse error, unexpected '\"'


  • Please log in to reply
5 replies to this topic

#1 beachglassdirect

beachglassdirect
  • New Members
  • Pip
  • Newbie
  • 3 posts
  • LocationMontauk New York

Posted 12 May 2006 - 08:14 PM

I am writing a script for dynamic links and images. I have based it on osCommerce 2.2 MS2. I get this prase error:
Parse error: parse error, unexpected '\"' in /home/beachgla/public_html/top.php on line 103

Here is the code of top.php
<?php
/*
    Eddie Schnell
    Beach Glass Direct.com
*/

// check if register_globals is enabled.
// since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
  if (function_exists("ini_get")) {
    ini_get("register_globals") or exit("Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.");
  }

// server variables
  define("HTTP_SERVER", "http://beachglassdirect.com"); 
  define("HTTPS_SERVER", "https://host274.ipowerweb.com/~beachgla");
  define("ENABLE_SSL", true); 
  define("HTTP_COOKIE_DOMAIN", "beachglassdirect.com");
  define("HTTPS_COOKIE_DOMAIN", "host274.ipowerweb.com");
  define("HTTP_COOKIE_PATH", "/");
  define("HTTPS_COOKIE_PATH", "/");
  define("DIR_WS_HTTP_CATALOG", "/");
  define("DIR_WS_HTTPS_CATALOG", "/");
  define("DIR_WS_FORMS", "forms/");
  define("DIR_WS_OASIS", "oasis/");
  define("DIR_WS_CATALOG", "catalog/");
  define("DIR_FS_SITE", "/home/beachgla/public_html/");
  
// set the type of request (secure or not)
  $request_type = (getenv("HTTPS") == "on") ? "SSL" : "NONSSL";

// set php_self in the local scope
  if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS["PHP_SELF"];

  if ($request_type == "NONSSL") {
    define("DIR_WS_CATALOG", DIR_WS_HTTP_CATALOG);
  } else {
    define("DIR_WS_CATALOG", DIR_WS_HTTPS_CATALOG);
  }

// define filenames
  define("FILENAME_DEFAULT", "index.php");
  define("FILENAME_CONTACT", "contact.php");
  define("FILENAME_DEALER_IDEA", "dealer-idea.php");
  define("FILENAME_GLASS", "glassbyounce.php");
  define("FILENAME_INFO", "info.php");
  define("FILENAME_JEWELRY", "jewelry.php");
  define("FILENAME_NET_RE_DIR", "net.php");
  define("FILENAME_OASIS_HOME", "oasis.php");
  define("FILENAME_ORNAMENTS", "ornaments.php");
  define("FILENAME_TELL_A_FRIEND", "tellafriend.php");
  define("FILENAME_OASIS_AGELESS_CAPS", "ageless.php");
  define("FILENAME_OASIS_AGELESS_PRIME", "agelessprime.php");
  define("FILENAME_OASIS_AGELESS_XTRA", "agelessxtra.php");
  define("FILENAME_OASIS_CP", "convenience.php");
  define("FILENAME_OASIS_CP_PRICE", "convenience_price.php");
  define("FILENAME_OASIS_DR", "dr.php");
  define("FILENAME_OASIS_FUNC_FOODS", "foods.php");
  define("FILENAME_OASIS_INTHINITY", "inthinity.php");
  define("FILENAME_OASIS_REGENICARE", "regenicare.php");
  define("FILENAME_FORMS_DEALER", "bd.php");
  define("FILENAME_FORMS_CONTACT", "contact.php");
  define("FILENAME_FORMS_CP", "convenience.php");
  define("FILENAME_FORMS_IDEAS", "ideas.php");
  
// The HTML href link wrapper function
  function tep_href_link($page = "", $parameters = "", $connection = "NONSSL") {
    global $request_type, $session_started, $SID;
    
        if ($connection == "NONSSL") {
      $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
    } elseif ($connection == "SSL") {
      if (ENABLE_SSL == true) {
        $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
      } else {
        $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
      }
    } else {
      die("<br><br><font color=\"#ff0000\"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>");
   
    if (!tep_not_null($page)) {
      die("<br><br><font color=\"#ff0000\"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>");
}

    if (tep_not_null($parameters)) {
      $link .= $page . "?" . tep_output_string($parameters);
      $separator = "&";
    } else {
      $link .= $page;
      $separator = "?";
    }

    while ( (substr($link, -1) == "&") || (substr($link, -1) == "?") ) $link = substr($link, 0, -1);

////
// The HTML image wrapper function
  function tep_image($src, $alt = "", $width = "", $height = "", $parameters = "") {
    if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == "false") ) {
      return false;
    }

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
    $image = ("<img src="" . tep_output_string($src) . "" border="0" alt="" . tep_output_string($alt) . """); LINE 103
}
    if (tep_not_null($alt)) {
      $image .= " title=" " . tep_output_string($alt) . " "";
    }

    if ( (CONFIG_CALCULATE_IMAGE_SIZE == "true") && (empty($width) || empty($height)) ) {
      if ($image_size = @getimagesize($src)) {
        if (empty($width) && tep_not_null($height)) {
          $ratio = $height / $image_size[1];
          $width = $image_size[0] * $ratio;
        } elseif (tep_not_null($width) && empty($height)) {
          $ratio = $width / $image_size[0];
          $height = $image_size[1] * $ratio;
        } elseif (empty($width) && empty($height)) {
          $width = $image_size[0];
          $height = $image_size[1];
        }
      } elseif (IMAGE_REQUIRED == "false") {
        return false;
      }
    }

    if (tep_not_null($width) && tep_not_null($height)) {
      $image .= " width="" . tep_output_string($width) . "" height="" . tep_output_string($height) . """;
    }

    if (tep_not_null($parameters)) $image .= " " . $parameters;

    $image .= ">";

    return $image;
  }

// set the cookie domain
  $cookie_domain = (($request_type == "NONSSL") ? HTTP_COOKIE_DOMAIN : HTTPS_COOKIE_DOMAIN);
  $cookie_path = (($request_type == "NONSSL") ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH);
?>

~~~~~~~~~~~~
Eddie Schnell
Custom PC Builder

#2 Carth

Carth
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationUK

Posted 12 May 2006 - 08:21 PM

You must escape your quotes! Change

$image = ("<img src="" . tep_output_string($src) . "" border="0" alt="" . tep_output_string($alt) . """);

to

$image = ("<img src=\"" . tep_output_string($src) . "\" border=\"0\" alt="\" . tep_output_string($alt) . "\"");


#3 beachglassdirect

beachglassdirect
  • New Members
  • Pip
  • Newbie
  • 3 posts
  • LocationMontauk New York

Posted 12 May 2006 - 08:22 PM

Now I get this:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/beachgla/public_html/top.php on line 103

Parse error: parse error, unexpected '\"' in /home/beachgla/public_html/top.php on line 103

~~~~~~~~~~~~
Eddie Schnell
Custom PC Builder

#4 beachglassdirect

beachglassdirect
  • New Members
  • Pip
  • Newbie
  • 3 posts
  • LocationMontauk New York

Posted 16 May 2006 - 11:44 AM

Anyone, Please Help [img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /]
~~~~~~~~~~~~
Eddie Schnell
Custom PC Builder

#5 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 16 May 2006 - 12:48 PM

I don't understand the reason for the (). Those are unnecessary.

$image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

Give that a shot.

Info: PHP Manual


#6 Advancewebsoft

Advancewebsoft
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 01 July 2006 - 11:34 PM

Just correct your code,

from this
$image = ("<img src="" . tep_output_string($src) . "" border="0" alt="" . tep_output_string($alt) . """);
to this
$image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

from this
$image .= " title=" " . tep_output_string($alt) . " "";
to this
$image .= ' title=" ' . tep_output_string($alt) . ' "';

from this
$image .= " width="" . tep_output_string($width) . "" height="" . tep_output_string($height) . """;
to this
$image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';

You also have some error with { } messed up, correct them too. And be ware with OsCommerce modifications in future :)

Best,
Advance Team
Official site http://www.advancewebsoft.com
Oscommerce Solutions: http://www.advancewe...oscommerce.html




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users