1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Parse error: syntax error, unexpected '<'

Discussion in 'PHP' started by Pixel Dynamics, Oct 25, 2006.

  1. furtive

    furtive Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #41
    It's still giving me the same error. I noticed that there are only 7 right curly brackets, and 9 left curly brackets in the whole code. I am guessing this has something to do with it.
    SEMrush
     
    furtive, Nov 17, 2012 IP
    SEMrush
  2. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,985
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #42
    Yes, just going through your code and a few things appear wrong, or maybe that is just my current disorientated state? :D

    <?php
    if($_POST['registerbutton']) {
    
    	### SETUP SOME VARIABLES ###
        $user = $_POST['username'];
        $email = $_POST['email'];
        $password = $_POST['password'];
    	
    	### I ASSUME THIS IS TO DO WITH FORM DEFAULT VALUES ###
        if ($user == "Username") {
            $user = "";
    	}	
        if ($email == "Email") {
            $email = "";
    	}
    	
    	### CHECKING IF THE FORM HAS BEEN CORRECTLY FILLED ###
        if ($user && $email && $password) {
    	
    		### CHECKING THE EMAIL ADDRESS IS IN THE CORRECT FORMAT ###
            if (strstr($email, "@")&&(strstr($email, ".")) {
    		
                require("design/connect.php");
                $query = mysql_query("SELECT * FROM users WHERE username='$user'");
                $numrows = mysql_num_rows($query);
                if ($numrows == 1){
                    $query = mysql_query("SELECT * FROM users WHERE email='$email'");
                    $numrows = mysql_num_rows($query);
                } else {
                    echo "There is already an account registered with this email address. $form";
                } else {
                    echo "That username has been taken. $form";
                }
    		
    		### IF THE EMAIL FORMAT IS WRONG ###
            } else {
                echo "That is not a valid email. $form";
            }
    	
    	### IF THE FORMAT HASN'T BEEN FILLED OUT ###
        } else {
            echo "You did not fill in the required fields. $form";
    	}
    
    ### IF THE REGISTER BUTTON WASN'T CLICKED ###
    } else {
    	echo "$form";
    }
    ?>
    PHP:
     
    ryan_uk, Nov 17, 2012 IP
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #43
    <?php require("design/top.php"); ?>
    <title>refreshvideos - Register</title>
    <div id="left">
    <p>Register here</p>
    <p>
    <?php
    
    $form = "<form action='register.php' method='POST'>
    <table>
        <tr>
            <td><table style='margin-left: auto; margin-right:auto;'>
                        <table cellspacing='10px'>
                            <tr>
                                <td><input class='textbox' type='text' id='usernamebox2' name='username' tabindex='1' value='Username' onfocus='usernamebox_focus();' onblur='usernamebox_blur();'></td>
                
                            </tr>
                            <tr>
                                <td><input class='textbox' type='text' id='passwordbox2' name='password' tabindex='2' value='Password' onfocus='passwordbox_focus();' onblur='passwordbox_blur();'></td>
                                
                            </tr>
                            <tr>
                                <td><input class='textbox' type='text' id='emailbox' name='email' tabindex='3' value='Email' onfocus='emailbox_focus();' onblur='emialbox_blur();'></td>
                            </tr>
                            <tr>
                                <td><input type='submit' class='button' name='registerbutton' value='Register'><br></td>
                                <td><font size='-2'>(all fields required)</font></td>
                            </tr>
                        </table></td>
        </tr>
    </table>
    </form>";
    
    if ($_POST['registerbutton']) {
        $user = $_POST['username'];
        $email = $_POST['email'];
        $password = $_POST['password'];
        
        if ($user == "Username")
            $user = "";
        if ($email == "Email")
            $email = "";
            
        if ($user && $email && $password) {
            if (strstr($email, "@")&&(strstr($email, "."))[COLOR=#ff0000][B]) [/B][/COLOR]{
                require("design/connect.php");
                
                $query = mysql_query("SELECT * FROM users WHERE username='$user'")
                $numrows = mysql_num_rows($query);
                
                if ($numrows == 1){
                $query = mysql_query("SELECT * FROM users WHERE email='$email'")
                $numrows = mysql_num_rows($query);
                }
                else{
                    echo "There is already an account registered with this email address. $form";
                }
                else{
                    echo "That username has been taken. $form";
                }
            }
            else{
                echo "That is not a valid email. $form";
            }
        }
        else {
            echo "You did not fill in the required fields. $form";
        }
        
        
    }
    else{
        echo "$form";
    }
        
    
    ?>
    </p>
    </div>
    <?php require("design/bottom.php"); ?>
    Code (markup):
    Look at the red ). It was expecting a ) so the } was unexpected. (In the future, give the line number too.) Everything else seems to be matched (according to my editor).
     
    Rukbat, Nov 17, 2012 IP
  4. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,985
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #44
    Maybe it's due to how I'm feeling, but there is a logic error in your code and the below would "fix" it. To be honest though, I would code it all a bit different. I guess you are just starting with PHP and you will improve with experience.

                if ($numrows == 1){
    				echo "That username has been taken. $form";
    			} else {
                    $query = mysql_query("SELECT * FROM users WHERE email='$email'");
                    $numrows = mysql_num_rows($query);
    				if($numrow == 1) {
    					echo "There is already an account registered with this email address. $form";
    				} else {
    					### WORKED? ###
    				}
                } 
    PHP:
     
    ryan_uk, Nov 17, 2012 IP
  5. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,985
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #45
    How did I miss that? :eek: A couple of ; missing at the end of some lines (added into the one I pasted earlier).
     
    ryan_uk, Nov 17, 2012 IP
  6. abhirampathak3

    abhirampathak3 Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #46
    Get rid of the '.' (dot) operator and the single quotes in the array references... Code:

    SET datetime='$row[datetime]',...
     
    abhirampathak3, Nov 19, 2012 IP
  7. mamahgou

    mamahgou Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #47
    i have the same problem...i can't read all this....
     
    mamahgou, Dec 25, 2012 IP
  8. Zerak

    Zerak Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #48
    It's because you haven't closed the php tag when you started the html part.

    <?php
    PHP code here
    ?>
    HTML HERE
    <?php
    PHP HERE
    ?>
     
    Zerak, Dec 25, 2012 IP
  9. mirilailai

    mirilailai Greenhorn

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #49
    Hi guys,
    I've got the same problem and my script is really short but I still don't find what's wrong..
    Error:

    Parse error: syntax error, unexpected '<' in/home/a7431899/public_html/modules/mod_cmp_blank/tmpl/default.php(79) : eval()'d code on line 1
    Code:

    <?php
     
     
     
    // no direct access
     
    defined('_JEXEC') or die;
     
     
     
    $url = JURI::base();
     
     
     
    $scriptenable=$params->get('scriptenable');
     
    $script=$params->get('script');
     
     
     
    $cssenable=$params->get('cssenable');
     
    $css=$params->get('css');
     
     
     
    $phpenable=$params->get('phpenable');
     
    $php=$params->get('phpcode');
     
     
     
    $htmlenable=$params->get('htmlenable');
     
    $html=$params->get('htmlcode');
     
     
     
    $stylecss=$params->get('stylecss');
     
    $idmodule=$params->get('idmodule');
     
    $classmodule=$params->get('classmodule');
     
     
     
    $order=$params->get('codeorder');
     
     
     
     
     
     
     
    $doc =& JFactory::getDocument();
     
    $content = "";
     
     
     
    if ($scriptenable==1){
     
      $doc->addCustomTag( $script );
     
    }
     
    if ($cssenable==1){
     
      $doc->addStyleDeclaration($css,'text/css');
     
    }
     
    if ($stylecss!=""){
     
      $stylecss="style=\"$stylecss\"";
     
    }
     
    if ($idmodule!=""){
     
      $idmodule="id=\"$idmodule\"";
     
    }
     
    if ($classmodule!=""){
     
      $classmodule="class=\"$classmodule\"";
     
    }
     
     
     
    $content ="<div $idmodule $classmodule $stylecss>";
     
    if ($order==0) {
     
      if ($htmlenable==1){
     
        $content.=$html;
     
      }
     
      if ($phpenable==1){
     
        $content.=eval($php);
     
      }
     
    } else {
     
      if ($phpenable==1){
     
        $content.=eval($php);
     
      }
     
      if ($htmlenable==1){
     
        $content.=$html;
     
      }
     
    }
     
    $content.="</div>";
     
     
     
     
     
    ?>
     
     
    
    PHP:
     
    mirilailai, Feb 7, 2013 IP
  10. Pierre0101

    Pierre0101 Greenhorn

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #50
    Hello Their,
    i have a little problem of Parse Erro: Systax Error,
    I just dont undderstand what i did wrong :(
    Here is my site jordanstile.com

    The page show:
    Parse error: syntax error, unexpected '<' in /home/virtual/site526/fst/var/www/html/wp-content/themes/organic_portfolio_gray/includes/custom-header.php on line 8

    Here is the code:
    <?php
    //Custom Header Image Code -- from the WordPress.com API
    define('NO_HEADER_TEXT', true);
    define('HEADER_IMAGE', '%s/images/logo.png'); // %s is theme dir uri
    define('HEADER_IMAGE_WIDTH', 960);
    define('HEADER_IMAGE_HEIGHT', 100);

    function header_style() { ?>
    <style type="text/css">
    #header #title a {
    background: url(<?php header_image(); ?>) no-repeat;
    }
    </style>
    <?php }
    function admin_header_style() { ?>
    <style type="text/css">
    #headimg {
    width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
    height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
    background-image: url(<?php header_image(); ?>) top left no-repeat;
    }
    #headimg h1,
    #headimg #desc {
    display: none;
    }
    }
    </style>
    <?php }
    add_custom_image_header('header_style', 'admin_header_style'); //Add the custom header
    ?>

    Thank you for your precious help!

    Sorry i'm newbie, and try to understand, I know you have experience and i will very appreciate to see my site get back to life...
     
    Pierre0101, Feb 8, 2013 IP
  11. Pierre0101

    Pierre0101 Greenhorn

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #51
    All Good It's fixed now!
    I dont now why but my computer has copy and past a code that wasn't supposed to be there.
     
    Pierre0101, Feb 8, 2013 IP
  12. stajma

    stajma Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #52
    Same error as in other cases Parse error: syntax error, unexpected '<' ineventi/functions/theme-options.php on line 385. This is a copy of lines near 385 and in bold is line 385; please help me to solve this problem.



    <tr valign="top"><th scope="row"><?php _e( 'Display Page Sidebar', 'eventi' ); ?></th>
    <td>
    <input type="checkbox" id="sidebar_show" name="oswc_front[sidebar_show]" value="1" <?php checked( true, $settings['sidebar_show'] ); ?> />
    <label for="sidebar_show"><?php _e( 'Display the page sidebar. If this option is enabled, the Frontpage Sidebar widget panel will extent all the way down the page. If this option is disabled, the Frontpage Sidebar widget panel will only display next to the featured slider and the rest of the page will be full-width.', 'eventi' ); ?></label>
    </td>
    </tr>

    <tr valign="top"><th scope="row"><?php _e( 'Unique Sidebar', 'eventi' ); ?></th>
    <td>
    <input type="checkbox" id="sidebar_unique" name="oswc_front[sidebar_unique]" value="1" <?php checked( true, $settings['sidebar_unique'] ); ?> />
    <label for="sidebar_unique"><?php _e( 'Display widgets from the Frontpage Sidebar widget panel instead of the Default Sidebar widget panel.', 'eventi' ); ?></label>
    </td>
    </tr>

    <tr valign="top">
    <td colspan="2">
    <h3><?php _e( 'Featured Slider', 'eventi' ); ?></h3>
    </td>
    </tr>

    <tr valign="top"><th scope="row"><?php _e( 'Display Featured Slider', 'eventi' ); ?></th>
    <td>
    <input type="checkbox" id="featured_show" name="oswc_front[featured_show]" value="1" <?php checked( true, $settings['featured_show'] ); ?> />
    <label for="featured_show"><?php _e( 'Display the Featured slider area (Nivo slider)', 'eventi' ); ?> </label>
    </td>
    </tr>/>

    <tr valign="top"><th scope="row"><label for="featured_duration"><?php _e( 'Slide Duration', 'eventi' ); ?></label></th>
    <td>
    <select id="featured_duration" name="oswc_front[featured_duration]"/>
    <?php $i=1;
    while ($i<=30) { ?>
    <option value="<?php echo $i; ?>"<?php if($settings['featured_duration']==$i) { ?> selected="selected"<?php } ?>><?php echo $i; ?></option>
    <?php $i++;
    } ?>
    </select>
    <?php _e( 'Number of seconds each slide will display before rotating', 'eventi' ); ?>
    </td>
    </tr>

    <tr valign="top"><th scope="row"><label for="featured_tag"><?php _e( 'Featured Tag', 'eventi' ); ?></label></th>
    <td>
    <input id="featured_tag" name="oswc_front[featured_tag]" type="text" value="<?php esc_attr_e($settings['featured_tag']); ?>" />
    <?php _e( 'Slug (not name) of the tag that you want to use to mark posts as Featured', 'eventi' ); ?>
    </td>
    </tr>

    <tr valign="top">
    <td colspan="2">
    <h3><?php _e( 'Spotlight Slider', 'eventi' ); ?></h3>
    </td>
    </tr>

    <tr valign="top"><th scope="row"><?php _e( 'Display Slider', 'eventi' ); ?></th>
    <td>
    <input type="checkbox" id="spotlight_show" name="oswc_front[spotlight_show]" value="1" <?php checked( true, $settings['spotlight_show'] ); ?> />
    <label for="spotlight_show"><?php _e( 'Display the Spotlight slider area below the Featured slider', 'eventi' ); ?></label>
    </td>
    </tr>

    <tr valign="top"><th scope="row"><?php _e( 'Scroll Slider', 'eventi' ); ?></th>
    <td>
     
    stajma, May 10, 2013 IP