Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    jbb
    jbb is offline
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Could use some help: Parse error: syntax error

    I have been racing my brain trying to figure out the error in this code..I have gone through line 91 multiple times...including the code before to ensure it wasn't causing the line 91 error. I used multiple php error tools but cannot work out the bugs. I could really use some help with this. I appreciate any insight.

    PHP Code:
    <?php

    /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
    // +----------------------------------------------------------------------+
    // | PHP version 4/5                                                      |
    // +----------------------------------------------------------------------+
    // | This source file is a part of iScripts Multicart                     |
    // +----------------------------------------------------------------------+
    // | Authors: Programmer<programmer@armia.com>                              |
    // +----------------------------------------------------------------------+
    // | Copyrights Armia Systems, Inc and iScripts.com ï¿½ 2005                |
    // | All rights reserved                                                  |
    // +----------------------------------------------------------------------+
    // | This script may not be distributed, sold, given away for free to     |
    // | third party, or used as a part of any internet services such as      |
    // | webdesign etc.                                                       |
    // +----------------------------------------------------------------------+
    $Current_page    basename($_SERVER['PHP_SELF']);

    $Current_page_seo    GetSeoTags($Current_page);
    ?>
    <?php  
    if(!isset($_SERVER['REQUEST_URI'])) {
        if(isset(
    $_SERVER['SCRIPT_NAME']))    $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];   else    $_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF'];
        if(
    $_SERVER['QUERY_STRING']) {
            
    $_SERVER['REQUEST_URI'] .=  '?'.$_SERVER['QUERY_STRING'];
        }
            }
    if
    (
    strcasecmp(basename($_SERVER['REQUEST_URI']),"install.php")==0) {
        ;
    }else {
                        if (
    INSTALLED ===true) {
            ;
        }else {
            if(
    strstr($_SERVER['PHP_SELF'],'admin') == TRUE || strstr($_SERVER['PHP_SELF'],'sellers') == TRUE || strstr($_SERVER['PHP_SELF'],'affiliates') == TRUE) {
                
    header("Location:../install/install.php");
            }    else {
                
    header("Location:./install/install.php");
            }
        }

    }
    if(
    basename($_SERVER['PHP_SELF']) == "payment.php" || basename($_SERVER['PHP_SELF']) == "yourpay_payment.php") {  ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml">
        <head>

        <?php  }  else {  ?>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml">
                <head>

                                                <?php  }  ?>

                    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                        <title><?php if($Current_page_seo['meta_title']!='') {
                                                echo 
    $Current_page_seo['meta_title'] ;
                                            } else {
                                                echo 
    htmlentities(SITE_NAME);
                                            } 
    ?></title>
                        <meta name="keywords" content="<?php if($Current_page_seo['meta_keywords']!='') {
                                                echo 
    $Current_page_seo['meta_keywords'] ;
                                            } else {
                                                echo 
    htmlentities(SITE_NAME);
                                            } 
    ?> " />
                        <meta name="description" content="<?php if($Current_page_seo['meta_description']!='') {
                                                echo 
    $Current_page_seo['meta_description'] ;
                                            } else {
                                                echo 
    htmlentities(SITE_NAME);
                                            } 
    ?>" />

                        <!--Rating css begins-->

                        <link href="./style/rating.css" rel="stylesheet" type="text/css">

                            <!--Rating css ends-->

    <?php   
    if(strstr($_SERVER['PHP_SELF'],'admin') == TRUE || strstr($_SERVER['PHP_SELF'],'sellers') == TRUE || strstr($_SERVER['PHP_SELF'],'affiliates') == TRUE || strstr($_SERVER['PHP_SELF'],'install') == TRUE) {
        if (
    INSTALLED===true) {
            
    $active_template displayTemplate();
        }
        
    ?>
                            <script src="../js/javascript_check.js"></script>
                            <link href="../themes/<?php echo $active_template[5]?>/template1-admin.css" rel="stylesheet" type="text/css">
                                <!--Template admin css begins-->
                                <style>
                                    .header{
                                        height:120px;
                                        border:solid 1px #E1E1E1;
                                        border-bottom:solid 15px<?php echo substr(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.subheading'))[2])[1],0,strlen(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.subheading'))[2])[1])-1);?>;
                                        background:#fff url(../images/header_grdnt.gif) repeat-x left bottom;
                                        margin-bottom:5px;
                                    }
                                    .copyright
                                    {
                                        background-color:<?php echo substr(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[2])[1],0,strlen(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[2])[1])-1);?>;
                                        border:solid 1px #C4C3C3;
                                        height:25px;
                                        color:<?php echo substr(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1],0,strlen(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1])-1);?>;
                                        padding-top:8px;

                                    }
                                    .login_btm_lnks1{
                                        font:11px Tahoma, Arial;
                                        color:<?php echo substr(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1],0,strlen(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1])-1);?>;
                                        margin-bottom:5px;
                                    }
                                    .login_btm_lnks1 A:link{
                                        font:11px Tahoma, Arial;
                                        color:<?php echo substr(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1],0,strlen(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1])-1);?>;
                                        margin-bottom:5px;
                                        text-decoration:none;


                                    }
                                    .login_btm_lnks1 A:visited{
                                        font:11px Tahoma, Arial;
                                        color:<?php echo substr(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1],0,strlen(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1])-1);?>;
                                        margin:8px 0px 5px;
                                        margin-bottom:5px;
                                        text-decoration:none;
                                    }

                                    #login_area_new{
                                        width:178px;
                                        height:179px;
                                        color:<?php echo substr(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1],0,strlen(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1])-1);?>;
                                        background-color:<?php echo substr(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'#login_area'))[4])[1],0,strlen(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'#login_area'))[4])[1])-1);?>;
                                        padding:20px 15px 0px;
                                    }

                                </style>

                                <!--Template admin css ends-->

        <?php  }  else {  ?>
                                <!--Template home css begins-->

                                <link href="./themes/<?php echo $active_template[4]?>" rel="stylesheet" type="text/css">
        <?php  }  ?>
                                    <!--Home page javscript begins-->
                                    <script src="<?php echo SITE_URL?>/js/script_homepage.js"></script>
                                    <script type="text/javascript" language="javascript" src="<?php echo SITE_URL?>/js/jquery.js"></script>
                                    <!--Home page javscript ends-->
                                    <!-- rating star script begins -->
                                    <script type="text/javascript" language="javascript" src="<?php echo SITE_URL?>/js/behavior.js"></script>
                                    <script type="text/javascript" language="javascript" src="<?php echo SITE_URL?>/js/rating.js"></script>
                                    <script type="text/javascript">AC_FL_RunContent = 0;</script>
                                    <script language="javascript" type="text/javascript" src="./js/AC_RunActiveContent.js"></script>
                                    <link href="favicon.ico" type="image/x-icon" rel="icon">
                                        <link href="favicon.ico" type="image/x-icon" rel="shortcut icon">
                                            <!-- rating star script ends -->
                                            </head>
    <?php


    $adminCurrency    
    GetAdminCurrency();

    $page            $_GET['page'];

    if(
    $page=='') {
        
    $page    =1;
    }

    if(isset(
    $_SERVER['HTTPS']) &&  $_SERVER["HTTPS"]=="on")
    {
       
    $site_url    SECURE_SITE_URL;
    }
    else
        {
        
    $site_url    SITE_URL;
    }


    ?>
    Last edited by jbb; 10-29-2012 at 02:21 PM.

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,331
    Thanks
    60
    Thanked 526 Times in 513 Posts
    Blog Entries
    4
    Parse error: syntax error

    Doesn't say much does it. You've seen those magic words and typed those and only those. You need to paste the actual complete error for us to help you properly.

    One thing I will say, is that you are missing a few ; symbols - especially before your closing ?> tags.

    This is one here:
    <?php echo SITE_URL?>

    Should be:
    <?php echo SITE_URL; ?>

    Note that there must be a space between ; and ?>. In other words it must be ; ?> and NOT ;?>
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #3
    jbb
    jbb is offline
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for the info. The error says an unexpected "." on line 91.. In looking at the code in dreamweaver it seems to be the same error for multiple parts in the code. This is where it is showing the first error

    Code:
    border-bottom:solid 15px<?php echo substr(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.subheading'))[2])[1],0,strlen(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.subheading'))[2])[1])-1);?>;
    all the errors are in the style part of the code located here:

    Code:
    <style>
                                    .header{
                                        height:120px;
                                        border:solid 1px #E1E1E1;
                                        border-bottom:solid 15px<?php echo substr(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.subheading'))[2])[1],0,strlen(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.subheading'))[2])[1])-1);?>;
                                        background:#fff url(../images/header_grdnt.gif) repeat-x left bottom;
                                        margin-bottom:5px;
                                    }
                                    .copyright
                                    {
                                        background-color:<?php echo substr(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[2])[1],0,strlen(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[2])[1])-1);?>;
                                        border:solid 1px #C4C3C3;
                                        height:25px;
                                        color:<?php echo substr(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1],0,strlen(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1])-1);?>;
                                        padding-top:8px;
    
                                    }
                                    .login_btm_lnks1{
                                        font:11px Tahoma, Arial;
                                        color:<?php echo substr(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1],0,strlen(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1])-1);?>;
                                        margin-bottom:5px;
                                    }
                                    .login_btm_lnks1 A:link{
                                        font:11px Tahoma, Arial;
                                        color:<?php echo substr(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1],0,strlen(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1])-1);?>;
                                        margin-bottom:5px;
                                        text-decoration:none;
    
    
                                    }
                                    .login_btm_lnks1 A:visited{
                                        font:11px Tahoma, Arial;
                                        color:<?php echo substr(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1],0,strlen(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1])-1);?>;
                                        margin:8px 0px 5px;
                                        margin-bottom:5px;
                                        text-decoration:none;
                                    }
    
                                    #login_area_new{
                                        width:178px;
                                        height:179px;
                                        color:<?php echo substr(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1],0,strlen(explode("color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'.copyright_area'))[3])[1])-1);?>;
                                        background-color:<?php echo substr(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'#login_area'))[4])[1],0,strlen(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]"),'#login_area'))[4])[1])-1);?>;
                                        padding:20px 15px 0px;
                                    }
    
                                </style>

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,331
    Thanks
    60
    Thanked 526 Times in 513 Posts
    Blog Entries
    4
    You're still not listening.

    Look at the end of that line:
    ;?>
    I told you that you need spaces there. In your text editor, use the replace function to replace:
    ;?>
    with
    ; ?>

    I think thats fairly simple no?

    As for the rest.. your use of file_get_contents() is wrong. Look at the double quotes you're using:

    file_get_contents(""../themes/".$active_template[4]")
    Your quotes are messed up.

    ,'.subheading'))[2])[1],0,strlen(explode("background-color:",explode("\n",strstr(file_get_contents(""../themes/".$active_template[4]")
    Again, bad quotes.

    Your code is full of errors like that. You're using two double quotes where there should only be one (and realistically they should be single quotes) and then not using them where you should.

    When you write a function call, you should be doing it like this:
    file_get_contents();

    Then fill in the information inside it - start with quote marks:
    file_get_contents("");

    Now do the rest:
    file_get_contents("../themes/{$active_template[4]}");

    Why do it like that? Because it ensures that you put in a beginning AND end ( and ), " and ", ' and ' etc. Then you go back into the middle and put in the rest of your information such as the file path. If you don't use this technique, you'll forget to terminate strings and functions properly.

    Also you have one very long line of confusing php code there. You shouldn't mix php into html and css like that. It's messy, confusing and hard to debug (as you've found out). You should be keeping your php seperate and at the very least, at the top of your html / css before the <head> tag. Process your data and then put it into your html.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Single line PHP code doesn't require the semi-colon at the end. The space at the end also won't make a difference. Come to think of it, the semi-colon isn't required on the last instruction in PHP at all. Although I'd recommend consistently using it.

    That is a disastrous block of PHP code. You can write a function for it, but you'll need to normalize the structure in some way. The calls you have here are fairly consistent for the offsets accessed, but not always consistent which is a pity. If you could make it consistent, separating it out into a function of its own will make the calling code a lot more simple to read. Assuming that the template doesn't change either, you can use a static variable within your function to effectively cache the result from a previous lookup (no need to keep checking the file for data that hasn't changed).

  • #6
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,331
    Thanks
    60
    Thanked 526 Times in 513 Posts
    Blog Entries
    4
    Quote Originally Posted by Fou-Lu View Post
    Single line PHP code doesn't require the semi-colon at the end. The space at the end also won't make a difference. Come to think of it, the semi-colon isn't required on the last instruction in PHP at all. Although I'd recommend consistently using it.
    Hmm I thought the space did make a difference? I'm sure I had problems with it in the past. I know at the front / beginning end it does and had assumed it was the same at the end too
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Beginning definitely needs the space, but best I know the end has never required it.
    Soon we'll be able to use the inline echo with <?= regardless of the short_open_tags directive (as of 5.4). These typically don't use semi colons at all: <?=$var?> is how I usually see them. Personally, I hate them. Lol.

  • #8
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,331
    Thanks
    60
    Thanked 526 Times in 513 Posts
    Blog Entries
    4
    I used to love short tags until I had a project which needed a rss feed to be generated by php in the .xml file. Then I realised why some people hate it.. the opening <? for the xml caused me a serious headache until I turned off short tags
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •