Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Suspecion in admin/coupon_admin.php

    I have just discovered something strange from admin/coupon_admin.php file.

    From this line:

    PHP Code:
    <td align="left"><?php echo '&nbsp;&nbsp;<a href="' zen_href_link(FILENAME_COUPON_ADMIN'cid=' $_GET['cid'] . (isset($_GET['status']) ? '&status=' $_GET['status'] : '') . (isset($_GET['page']) ? '&page=' $_GET['page'] : '')); ?>"><?php echo zen_image_button('button_cancel.gif'IMAGE_CANCEL); ?></a>
    I suspect there's a parsing error somewhere, since - from the rest of that block - below:

    PHP Code:
    </td>
          </tr>
          </td></table></form>
          </tr>

          </table></td>
    <?php
        
    break;
      default:
    ?>
        <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
              <tr>
                <td class="pageHeading"><?php echo HEADING_TITLE?></td>
                <td class="main"><?php echo zen_draw_form('status'FILENAME_COUPON_ADMIN'''get'); ?>
    <?php
        $status_array
    [] = array('id' => 'Y''text' => TEXT_COUPON_ACTIVE);
        
    $status_array[] = array('id' => 'N''text' => TEXT_COUPON_INACTIVE);
        
    $status_array[] = array('id' => '*''text' => TEXT_COUPON_ALL);

        if (
    $_GET['status']) {
          
    $status zen_db_prepare_input($_GET['status']);
        } else {
          
    $status 'Y';
        }

        echo 
    zen_hide_session_id();
        echo 
    HEADING_TITLE_STATUS ' ' zen_draw_pull_down_menu('status'$status_array$status'onChange="this.form.submit();"') .
        
    zen_draw_hidden_field('page'$_GET['page']);
    ?>
                  </form>
               </td>
                <td class="main">
    <?php
    // toggle switch for editor
            
    $editor_array = array(array('id' => '0''text' => TEXT_NONE),
                                  array(
    'id' => '1''text' => TEXT_HTML_AREA));
            echo 
    TEXT_EDITOR_INFO zen_draw_form('set_editor_form'FILENAME_COUPON_ADMIN'''get') . '&nbsp;&nbsp;' zen_draw_pull_down_menu('reset_editor'$editor_array, ($_SESSION['html_editor_preference_status'] == 'HTMLAREA' '1' '0'), 'onChange="this.form.submit();"') .
            
    zen_hide_session_id() .
            
    zen_draw_hidden_field('action''set_editor') .
            
    '</form>';
    ?>
    </td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
              <tr>
                <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr class="dataTableHeadingRow">
                    <td class="dataTableHeadingContent"><?php echo COUPON_NAME?></td>
                    <td class="dataTableHeadingContent" align="center"><?php echo COUPON_AMOUNT?></td>
                    <td class="dataTableHeadingContent" align="center"><?php echo COUPON_CODE?></td>
                    <td class="dataTableHeadingContent" align="center"><?php echo COUPON_ACTIVE?></td>
                    <td class="dataTableHeadingContent" align="center"><?php echo COUPON_START_DATE?></td>
                    <td class="dataTableHeadingContent" align="center"><?php echo COUPON_EXPIRE_DATE?></td>
                    <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION?>&nbsp;</td>
                  </tr>
    <?php
        
    if ($_GET['page'] > 1$rows $_GET['page'] * 20 20;
        if (
    $status != '*') {
          
    $cc_query_raw "select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_products, restrict_to_categories, date_created,date_modified, coupon_active from " TABLE_COUPONS ." where coupon_active='" zen_db_input($status) . "' and coupon_type != 'G'";
        } else {
          
    $cc_query_raw "select coupon_id, coupon_code, coupon_amount, coupon_type, coupon_start_date,coupon_expire_date,uses_per_user,uses_per_coupon,restrict_to_products, restrict_to_categories, date_created,date_modified, coupon_active from " TABLE_COUPONS " where coupon_type != 'G'";
        }
        
    $cc_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_DISCOUNT_COUPONS$cc_query_raw$cc_query_numrows);
        
    $cc_list $db->Execute($cc_query_raw);
        while (!
    $cc_list->EOF) {
          
    $rows++;
          if (
    strlen($rows) < 2) {
            
    $rows '0' $rows;
          }
          if (((!
    $_GET['cid']) || (@$_GET['cid'] == $cc_list->fields['coupon_id'])) && (!$cInfo)) {
            
    $cInfo = new objectInfo($cc_list->fields);
          }
          if ( (
    is_object($cInfo)) && ($cc_list->fields['coupon_id'] == $cInfo->coupon_id) ) {
            echo 
    '          <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' zen_href_link(FILENAME_COUPON_ADMINzen_get_all_get_params(array('cid''action')) . 'cid=' $cInfo->coupon_id '&action=voucheredit') . '\'">' "\n";
    It is all showing in red (I'm using a PHP software that can show results in color - green for: good - red for: bad).

    However, all the rest of the file looks fine. It is simply these blocks that seem to be suspecious as I was wondering if, from the first line I have posted above, there might be a quote (or apostrophized error) missing somewhere.

  2. #2
    Join Date
    Mar 2004
    Posts
    16,042
    Plugin Contributions
    5

    Default Re: Suspecion in admin/coupon_admin.php

    what do you do,
    go through every file looking for typos ......LOL
    Zen cart PCI compliant Hosting

  3. #3
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Suspecion in admin/coupon_admin.php

    Actually, no - this one was by coincidence. I was looking for a specific query name (another project of my own - none related to this post) and then I just discovered these unusual readings - just like that.

    (And ... yes, sometimes, I do look for typos. ).

  4. #4
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Suspecion in admin/coupon_admin.php

    Quote Originally Posted by TheOracle
    I suspect there's a parsing error somewhere, since - from the rest of that block

    .....

    It is all showing in red (I'm using a PHP software that can show results in color - green for: good - red for: bad).
    1. What software are you using?
    2. There is no error.

    I suspect that it's complaining that it sees no opening <A> tag to match the closing </A> tag. ... because the opening of the A tag is inside a PHP echo() statement, and not just in the raw HTML.

    While one could argue that maybe the best programming practice wasn't used in this case, there is no syntax error.

    All the admin files will be overhauled in the near future, and this along with many other things will be tidied for consistency.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Suspecion in admin/coupon_admin.php

    While one could argue that maybe the best programming practice wasn't used in this case, there is no syntax error.
    It is not about argumentation or anything. If, from your point above, you're saying that:

    I suspect that it's complaining that it sees no opening <A> tag to match the closing </A> tag. ... because the opening of the A tag is inside a PHP echo() statement, and not just in the raw HTML.
    then it's good enough for me, on this one, since I just find it strange that long paragraphs, in red, were showing up as the rest of the file is showing up correctly. I'm using DzSoft PHP Editor as a PHP text editor. I find it really good.

 

 

Similar Threads

  1. v150 [duplicate] myDEBUG coupon_admin.php
    By ray-the-otter in forum Bug Reports
    Replies: 3
    Last Post: 2 Jul 2013, 10:47 AM
  2. v151 coupon_admin.php contains double p tag
    By Design75 in forum Bug Reports
    Replies: 3
    Last Post: 14 Nov 2012, 03:45 AM

Posting Permissions

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