Parse error: syntax error, unexpected $end in ...

Discussion in 'PHP' started by alexlfcorrea, Dec 30, 2010.

  1. #1
    Hello Everyone! :)

    First able thank you very much for your attention.

    I am changing a template like groupon script and last night i got this error when I was creating a DEAL... Is a website like Groupon. Everything works fine apart of this function... " CREATE A DEAL".... get this error :mad:
    -----------------
    Parse error: syntax error, unexpected $end in /home/clube271/public_html/manage/deal/create.php on line 205
    ----------------

    I really don´t now how to fix this one... i was doing my best to understand but i can´t... i Tried everything and nothing...

    If somebody could check the file and tell me what is going on I would be very happy.
    The file is the create.php and the error is on line 205

    -----------------------------------------------------------------------------------------------

    <?php

    ob_start();

    require_once($_SERVER['DOCUMENT_ROOT'] . '/app.php');



    //error_reporting(E_ALL);

    need_dealer();

    $ob_content = ob_get_clean();



    if (is_partner()) {

    $partner_id = abs(intval($_SESSION['partner_id']));

    $login_partner = Table::Fetch('partner', $partner_id);

    }



    if ($_POST) {

    $deals = $_POST;

    $insert = array(

    'title', 'market_price', 'deals_price', 'end_time', 'begin_time', 'expire_time', 'min_number', 'max_number', 'summary', 'notice', 'conduser', 'per_number',

    'product', 'image', 'detail', 'userreview', 'systemreview', 'image1', 'image2', 'flv', 'card',

    'mobile', 'address', 'fare', 'express', 'delivery', 'credit',

    'user_id', 'state', 'city_id', 'group_id', 'partner_id', 'stage', 'seokey', 'seodesc',

    );

    $deals['user_id'] = $login_user_id;

    $deals['state'] = 'none';

    $deals['begin_time'] = strtotime($deals['begin_time']);

    $deals['city_id'] = abs(intval($deals['city_id']));// echo $deals['end_time'] . ' XX ';

    $deals['end_time'] = strtotime($deals['end_time']);

    //echo $deals['end_time'] ."/n"; echo "time == " . date('l dS \o\f F Y h:i:s A', $deals['end_time']); echo"/n/n". "Not allowed in the demo"; exit;

    $deals['expire_time'] = strtotime($deals['expire_time']);

    $deals['image'] = upload_image('upload_image', null, 'deals');

    $deals['image1'] = upload_image('upload_image1', null, 'deals');

    $deals['image2'] = upload_image('upload_image2', null, 'deals');

    $table = new Table('deals', $deals);

    $table->SetStrip('summary', 'detail', 'systemreview', 'notice', 'userreview', 'product', 'title', 'seokey', 'seodesc');



    if ($deals_id = $table->insert($insert) ) {
    if (abs(intval($INI['system']['dealalert']))== 2 && ($_POST["stage"]=='1-featured' || $_POST["stage"]=='approved')) {
    $indcall=1;
    $id = $deals_id;
    $action = 'noticesubscribe';
    $nid = 0;
    $allow_flag = 'f8WE45Y^';
    require_once($_SERVER['DOCUMENT_ROOT'] . '/functions/ajax/asmailer.php');
    // echo ' ...Yes';
    }
    // echo ' ...No';
    Utility::Redirect( WEB_ROOT . "/manage/deal/index.php");
    }

    else {

    $profile = Table::Fetch('leader', $login_user_id, 'user_id');

    //1

    $deals = array();

    $deals['user_id'] = $login_user_id;

    $deals['begin_time'] = strtotime('+1 days');

    $deals['end_time'] = strtotime('+2 days');

    $deals['expire_time'] = strtotime('+3 months +1 days');

    $deals['min_number'] = 10;

    $deals['per_number'] = 1;

    $deals['market_price'] = 1;

    $deals['deals_price'] = 1;

    //3

    $deals['delivery'] = 'coupon';

    $deals['address'] = $profile['address'];

    $deals['mobile'] = $profile['mobile'];

    $deals['fare'] = 5;

    $deals['conduser'] = $INI['system']['conduser'] ? 'Y' : 'N';

    }



    $groups = DB::LimitQuery('category', array(

    'condition' => array( 'zone' => 'group', ),

    ));

    $groups = Utility::OptionArray($groups, 'id', 'name');



    if (is_partner()) {

    $condition = array(

    'id' => $partner_id,

    );

    $partners = DB::LimitQuery('partner', array(

    'condition' => $condition,

    ));

    } else {

    $partners = DB::LimitQuery('partner', array(

    'order' => 'ORDER BY id DESC',

    ));



    $partners = Utility::OptionArray($partners, 'id', 'title');

    }



    $selector = 'create';





    $bizstageoptions = array(

    'draft' => 'Save as Draft',

    'pending' => 'Submit for Approval',

    );



    $adminstageoptions = array(

    'draft' => 'Draft',

    'pending' => 'Pending',

    'approved' => 'Approved',

    '1-featured' => 'Approved + Featured Deal',

    );





    if (is_partner()) {

    include template('business_deals_create');

    }

    else {

    include template('manage_deals_create');

    }

    ----------------------------------------------------------------------------------------------

    Best Regards.

    Alex
    from Brazil
     
    alexlfcorrea, Dec 30, 2010 IP
  2. AssistantX

    AssistantX Peon

    Messages:
    173
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The line with
    if ($_POST) {
    Code (markup):
    opens a bracket but it is never closed anywhere in the rest of the code. You should also put a
    ?>
    Code (markup):
    at the end of the code.
     
    AssistantX, Dec 30, 2010 IP
  3. alexlfcorrea

    alexlfcorrea Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi AssistantX! Thank you very much for your replay...

    But where should I put the bracket to close?

    Regards.
     
    alexlfcorrea, Dec 30, 2010 IP
  4. AssistantX

    AssistantX Peon

    Messages:
    173
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I cannot answer that question fully, but I can say that it should not be before the end of this code:
    $deals['conduser'] = $INI['system']['conduser'] ? 'Y' : 'N';
    
    }
    Code (markup):
     
    AssistantX, Dec 30, 2010 IP
  5. alexlfcorrea

    alexlfcorrea Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Man you rocked!

    Great job... Thank you very much for your help.

    Regards,

    Alex

    PS.: I am new here...so, sorry about the question.... but did you not answer directly because have something to do with the poclicies rules?
     
    alexlfcorrea, Dec 30, 2010 IP
  6. AssistantX

    AssistantX Peon

    Messages:
    173
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    No, the reason is that since I am not the original developer and I do not have the original code, I cannot fully determine the original intentions so everything would be an educated guess. However, after analyzing the code again, I do believe I found the exact location where the bracket should go. I believe it should be placed directly after:
    
    Utility::Redirect( WEB_ROOT . "/manage/deal/index.php");
    }
    
    Code (markup):
     
    AssistantX, Dec 31, 2010 IP