1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Unexpected $end (Parse error)

Discussion in 'Do It Yourself (Not Computer-Related)' started by Knyfe, Nov 5, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. Knyfe

    Knyfe Thread Starter

    Joined:
    Nov 5, 2011
    Messages:
    2
    I apologize if this is in the wrong section of the forum.

    I am currently working on adding a CAPTCHA code to a blog script on my website, and I keep running into Parse errors. Usually I can work them out on my own, but I'm fairly new to PHP, and haven't been able to figure this one out.

    "Parse error: syntax error, unexpected $end in /home/a2611929/public_html/blognping/profile.php on line 76"

    This is the page's script:
    PHP:
    <?php

    define
    (ROOTPATH,'./');

    $title 'Your Profile';

    require_once(
    ROOTPATH."inc/begin_code.php");
    require_once(
    ROOTPATH."inc/spider.inc.php");
    require_once(
    ROOTPATH."inc/profile.inc.php");

    if (isset(
    $_POST['cancelled'])) {
        
    header('location:index.php');
    }

    if (isset(
    $_POST['submitted'])) {
        
    update();
    }

    if (
    $_GET['saveOnly'] !=1)
    {
        
    showForm();
    }
    bye();

    function 
    update()
    {
        foreach (
    $_POST as $k => $v) {
            $
    $k mysql_escape_string(trim($v));
        }
        
        if (
    Profile::isProfileSet()) {
            
    Profile::changeInfo(1'blog_id'$blog_id);
            
    Profile::changeInfo(1'blog_username'$blog_username);
            
    Profile::changeInfo(1'blog_password'$blog_password);
            
    Profile::changeInfo(1'blog_url'$blog_url);
            
    Profile::changeInfo(1'blog_name'$blog_name);
            return 
    true;
        }
        
        
    $db =& new db;
        
    $sql "INSERT INTO #_profiles (profileId, blog_id, blog_username, blog_password, blog_url, blog_name) VALUES('1', '$blog_id', '$blog_username', '$blog_password', '$blog_url', '$blog_name')";
        
    $db->change_db('profiles'$sql);
        return 
    true;
    }

    function 
    showForm()
    {
        
    $blogId       Profile::getInfo(1,'blog_id');
        
    $blogUserName Profile::getInfo(1,'blog_username');
        
    $blogPass     Profile::getInfo(1,'blog_password');
        
    $blogName     Profile::getInfo(1,'blog_name'); 
        include_once 
    ROOTPATH 'html/profile_form.html';
        
    bye();
    }

    function 
    bye()

        require_once 
    ROOTPATH 'inc/end_code.php';
        die;
    }

    {
        
    session_start();
        include_once 
    $_SERVER['DOCUMENT_ROOT'] . 'securimage/securimage.php';
        
    $securimage = new Securimage();
        if (
    $securimage->check($_POST['captcha_code']) == false) {
           
    // the code was incorrect
           // you should handle the error so that the form processor doesn't continue
           // or you can use the following code if there is no validation or you do not know how
        
    echo "The security code entered was incorrect.<br /><br />";
        
    cho"Please go <a href='javascript:history.go(-1)'>back</a> and try again.";
        exit;

    }

    ?>
     
  2. dukevyner

    dukevyner

    Joined:
    Nov 4, 2011
    Messages:
    787
    this would properly be better in web development but its ok... unexpected $end is a php error... i have had this plenty of times basicly you missed a } somewhere in your code and the page is still waiting for it..then it reaches the end... and taada... unexpected $end.. im having trouble finding... THERE!

    this is missing a } let me show you

    (red shows where you opened the first bracket and blue the second)
    did you notice that there is no blue } that's the issue you need to close the second one this is what i would do(the green is what i changed)
    hope this helps... If you have any problems with you php from here i'd love to help.. sorry it took so long to post this i would have found it in web development faster
     
  3. Knyfe

    Knyfe Thread Starter

    Joined:
    Nov 5, 2011
    Messages:
    2
    Ah, thank you! It's working now.
     
  4. dukevyner

    dukevyner

    Joined:
    Nov 4, 2011
    Messages:
    787
    no problem! your lucky that you server supports php errors some just give you a 500 error... and that is the worst, cause you don't know what the problem is... what line its on.. and if your calling on other php pages you don't even know what file caused the error... anyway if you any more problems or questions with php(or any other web coding) you can post here or private msg me I, any many others would be glad to help
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1025599

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice