Page 7 of 12 FirstFirst ... 56789 ... LastLast
Results 61 to 70 of 114
  1. #61
    Join Date
    Mar 2009
    Posts
    78
    Plugin Contributions
    0

    Default Re: PHP inside ezpages

    I think this piece of code in the header of the ez pages (includes/modules/pages/page/) is what is sending the form back to the index page of my gallery.

    $ezpage_id = (int)$_GET['id'];
    if ($ezpage_id == 0) zen_redirect(zen_href_link(FILENAME_DEFAULT));


    It seems that, since the ez page id is not being passed from the form, it is being set to 0, and therefore re-directing to the default page. (a whole lot of guessing from a fledgling phper) If I can just figure out how to pass the ez page id, I might have this solved.

    Otherwise, I will have to resort to setting this up outside the ezpage, as Dr. Byte has suggested (I'm reluctant to give up because I've spent days on this. Insert smiley here.)

    All input is much appreciated.

    Bill
    Last edited by lndlyb4; 26 Sep 2009 at 06:46 PM.

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

    Default Re: PHP inside ezpages

    Quote Originally Posted by lndlyb4 View Post
    <?php include ("http://www.blackoliveeastnursery.net/zenCart_boe/priceManager/priceList_ezInclude.php");?>
    I'm surprised that works, since most servers who pay any attention to security at all will strictly prohibit using a URL in an include() or require() statement.
    A MUCH safer approach would be to specify the physical path to the .php file, not a URL to it.
    .
    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.

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

    Default Re: PHP inside ezpages

    Quote Originally Posted by lndlyb4 View Post
    As I mentioned in my post, if I can just get the Action part of the form to send the page and id, I bet it would work.

    <form id="searchForm"action="http://www.blackoliveeastnursery.net/zenCart_boe/index.php?main_page=page&id=7" method="GET">

    ...

    It seems that, since the ez page id is not being passed from the form, it is being set to 0, and therefore re-directing to the default page.
    You could try forcing some additional form parameters by adding the main_page and id fields to your HTML inside your form, on the next line after your <form> tag:
    Code:
    <input type="hidden" name="main_page" value="page" />
    <input type="hidden" name="id" value="7" />
    (You'll be relieved to know that that's not PHP at all ... it's HTML :) )
    .
    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.

  4. #64
    Join Date
    Mar 2009
    Posts
    78
    Plugin Contributions
    0

    Default Re: PHP inside ezpages

    I'm surprised that works, since most servers who pay any attention to security at all will strictly prohibit using a URL in an include() or require() statement.
    A MUCH safer approach would be to specify the physical path to the .php file, not a URL to it.
    Yes, I think at the time I was too lazy to figure out the physical path, so I just put in the url to get to the include file.


    You could try forcing some additional form parameters by adding the main_page and id fields to your HTML inside your form, on the next line after your <form> tag:
    Code:

    <input type="hidden" name="main_page" value="page" />
    <input type="hidden" name="id" value="7" />
    Thank you. I will give this a try.

    I appreciate your patience with me. Right now I am re-arranging furniture in the dark.

  5. #65
    Join Date
    Mar 2009
    Posts
    78
    Plugin Contributions
    0

    Default Re: PHP inside ezpages

    Dr Byte,

    I think you're on to something here.

    I added the hidden inputs you suggested and I am now no longer being re-directed to the index page. In fact I remain on the price list (ez page #7) AND the correct category id is being passed based on the selection I make from the drop down box.

    The url for the page is as follows:

    http://blackoliveeastnursery.net/zen...egoryChoice=13

    However, the list is not filtering from the category id in the url. The entire list continues to display.

    The query in the include file is appended as such:

    if (isset($_GET['categoryChoice']) && $_GET['categoryChoice'] != "All")
    $query .= " AND p.master_categories_id = '".mysql_real_escape_string($_GET['categoryChoice'])."'";

    Outside of the ez page, this works correctly and filters the list by category.

    If I can get the query to read the category id in the url, I may be home free. (I wish I had a nickle for every time I thought that!)

    Bill

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

    Default Re: PHP inside ezpages

    Well ... putting this in an ezPage, after making the edit to tpl_page_default.php as you said you did, produces the desired results for me:
    Code:
    <form id="searchForm" action="/zc138/index.php" method="GET">
    
    <input type="hidden" name="main_page" value="page" />
    <input type="hidden" name="id" value="7" /> 
    
     <select id="categoryName" name="categoryChoice" style="text-align:center;">
     	<option value="All">All</option>
      	<option value="25">Begonias</option>
    	<option value="31">Butterfly Plants</option>
    	<option value="7">Cactus/Succulents</option>
    	<option value="29">Ferns</option>
      	<option value="27">Florida Natives</option>
      	<option value="3">Flowering Shrubs</option>
    	<option value="17">Flowering Trees</option>
    	<option value="28">Foliage Shrubs</option>
    	<option value="11">Fragrant Plants</option>
    	<option value="16">Fruit Trees</option>
    	<option value="10">Fruiting Plants</option>
      	<option value="5">Ground Cover</option>
    	<option value="13">Hanging Baskets</option>
    	<option value="2">Hedges</option>
    	<option value="30">Interior Plants</option>
    	<option value="13">New Releases</option>
    	<option value="9">Orn. Grasses</option>
    	<option value="22">Orn. Trees</option>
    	<option value="23">Palms</option>
    	<option value="19">Patio Trees</option>
    	<option value="6">Perennials</option>
    	<option value="32">Roses</option>
    	<option value="26">Seasonal</option>
    	<option value="8">Shade Plants</option>
    	<option value="21">Shade Trees</option>
    	<option value="20">Street Trees</option>
    	<option value="12">Tropicals/Exotics</option>
    	<option value="4">Vines</option>
    	</select>
    	
    	
    
    
    	<input type ="submit" value ="Show Plants">
    	
    </form>	
    
    <p>GET params=<br /><pre>
    <?php echo print_r($_GET, TRUE); ?></pre>
    </p>
    
    <p>
    <?php $query = 'BASE';
    if (isset($_GET['categoryChoice']) && $_GET['categoryChoice'] != "All")
    $query .= " AND p.master_categories_id = '".mysql_real_escape_string($_GET['categoryChoice'])."'"; 
    echo $query;
    ?>
    </p>
    ie: if I choose "Butterfly Plants", I get the following output, exactly as expected:
    Code:
    GET params=
    
    Array
    (
        [main_page] => page
        [id] => 7
        [categoryChoice] => 31
    )
    BASE AND p.master_categories_id = '31'
    .
    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.

  7. #67
    Join Date
    Mar 2009
    Posts
    78
    Plugin Contributions
    0

    Default Re: PHP inside ezpages

    hhhmmmm...

    This is very strange. I inserted the test code into my include page and I get the following results:

    Array
    (
    )


    SELECT * FROM

    zen_products p,
    zen_products_description pd,
    zen_products_price pr,
    zen_categories_description cd

    WHERE p.products_id = pd.products_id AND
    p.master_categories_id = cd.categories_id AND
    p.products_id = pr.products_id order by products_name

    The " AND p.master_categories_id = '".mysql_real_escape_string($_GET['categoryChoice'])" is not being echoed.

    Yet, in the url in the address bar, I have this

    http://blackoliveeastnursery.net/zen...egoryChoice=25

    Which seems correct.


    Also, I would like to implement your suggestion below to make sure that is not what is hanging this up. I am confused about the physical path because I'm not sure which file I am pulling the include into.

    I'm surprised that works, since most servers who pay any attention to security at all will strictly prohibit using a URL in an include() or require() statement.
    A MUCH safer approach would be to specify the physical path to the .php file, not a URL to it.
    thanks

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

    Default Re: PHP inside ezpages

    Quote Originally Posted by lndlyb4 View Post
    Array
    (
    )
    That tells you that the entire $_GET is no longer populated at that point. You must have something extra in your system to strip out all $_GET variable data by the time your page is called.
    Quote Originally Posted by lndlyb4 View Post
    The " AND p.master_categories_id = '".mysql_real_escape_string($_GET['categoryChoice'])" is not being echoed.
    Same reason.

    Quote Originally Posted by lndlyb4 View Post
    Also, I would like to implement your suggestion below to make sure that is not what is hanging this up. I am confused about the physical path because I'm not sure which file I am pulling the include into.
    Well, since the file exists inside your Zen Cart site, you can probably just use something relative to that location, ie: perhaps:
    include('priceManager/priceList_ezInclude.php');
    .
    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.

  9. #69
    Join Date
    Mar 2009
    Posts
    78
    Plugin Contributions
    0

    Default Re: PHP inside ezpages

    Dr Byte,

    Thank you for confirming my suspicion about that.

    When I get a chance I will rummage around in some of the files listed below that affect the ez pages to see if I can tell what's interfering with the GET. (Although, I think its a bit over my head.)

    tpl_page_default.php
    header_php.php
    ezpages.php
    others??

    I think I am at the point where I need to take a different tack and create the page outside of Zen Cart and just add my own login page to it. This may be the best way anyway, because I was planning to add more filtering capabilities to the page and would have likely run into more coding mysteries.

    You have been very gracious to spend so much time on this issue, although I did not solve it, I learned a lot from you along the way.

    p.s.

    Also thank you for the form you posted. This is probably something I can use in the future.

    thank you

    Bill

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

    Default Re: PHP inside ezpages

    Sometimes it's good to do a quick review of everything that's been changed on your site ... often that'll reveal clues: http://www.zen-cart.com/wiki/index.p...Obscure_Issues
    .
    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.

 

 
Page 7 of 12 FirstFirst ... 56789 ... LastLast

Similar Threads

  1. PHP inside EZ-Pages
    By digiprint in forum General Questions
    Replies: 0
    Last Post: 17 Jun 2013, 09:10 AM
  2. PHP code inside of an EZ page
    By tcarden in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 Dec 2012, 05:19 PM
  3. PHP inside EZpages
    By hookah in forum General Questions
    Replies: 3
    Last Post: 15 Nov 2008, 08:40 AM
  4. search inside php files
    By papadopoulos in forum General Questions
    Replies: 2
    Last Post: 20 Jun 2006, 02:31 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