Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    Aug 2009
    Posts
    368
    Plugin Contributions
    0

    Default Questions about integrating my own code

    I need a guideline on integrating my own code without security risk .

    I develop my self a piece of code in order to send mail when a desired product is on sale . JQuery inserted on tpl_product_info that is calling php files places on includes ( same place where configure.php is placed , because I need to have access on database ) . The problem is .htaccess file that is blocking access to *.php .
    Please provide a solution on placing the php files called by my custom jquery .

    thx

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Guideline on integrating own code

    Lots of stock files deeper in /includes/ communicate with the database. Why do you think your file needs to be that high in the file structure? What methods are you using for db access, and when do they come into play?

  3. #3
    Join Date
    Aug 2009
    Posts
    368
    Plugin Contributions
    0

    Default Re: Guideline on integrating own code

    Quote Originally Posted by gjh42 View Post
    Lots of stock files deeper in /includes/ communicate with the database. Why do you think your file needs to be that high in the file structure? What methods are you using for db access, and when do they come into play?
    1. tpl_product_info calling a jquery file . 2.Inside jquery file I call /include/my.php file 3. my.php file include .configure.php in order to access the database .

    configure.php is protected by .htaccess by standard zencart settings .


    I have put the php files on /includes because I thought I need include configure.php in order to have db access info . Please give me other solutions .
    Last edited by solo_400; 16 Jul 2012 at 01:40 PM.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Guideline on integrating own code

    Correct. For security reasons you cannot use webpages/jQuery/ajax/javascript/URLs to directly call PHP files located inside the /includes/ folder or its subfolders.
    .

    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 2009
    Posts
    368
    Plugin Contributions
    0

    Default Re: Guideline on integrating own code

    Thank you DrByte , can you please provide a possible solution ? I really need my code running .. what should I do ?

  6. #6
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Guideline on integrating own code

    Put your file in another folder. PHP scripts can be run from the root folder without those security restrictions. That would be a suitable place.
    .

    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. #7
    Join Date
    Aug 2009
    Posts
    368
    Plugin Contributions
    0

    Default Re: Guideline on integrating own code

    Quote Originally Posted by DrByte View Post
    Put your file in another folder. PHP scripts can be run from the root folder without those security restrictions. That would be a suitable place.
    Regarding the user/password/table_name : It is possible reading from configure.php which is included in /include and protected by .htaccess ? I don't want to put this info in my php .

  8. #8
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Guideline on integrating own code

    Right. So, include() the file when you need 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.

  9. #9
    Join Date
    Aug 2009
    Posts
    368
    Plugin Contributions
    0

    Default Re: Guideline on integrating own code

    Quote Originally Posted by DrByte View Post
    Right. So, include() the file when you need it.
    Thank you DOC , I think I did it !

    I think is impossible load configure.php from root directory without adding "Allow from localhost_IP" in my includes/.htaccess .

    <Files *.php>
    Order Deny,Allow
    Deny from all
    Allow from localhost_IP
    </Files>

    Do you think could be a security problem ?

    thx again
    Last edited by solo_400; 16 Jul 2012 at 11:10 PM.

  10. #10
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Guideline on integrating own code

    Quote Originally Posted by solo_400 View Post
    I think is impossible load configure.php from root directory without adding "Allow from localhost_IP" in my includes/.htaccess .

    <Files *.php>
    Order Deny,Allow
    Deny from all
    Allow from localhost_IP
    </Files>

    Do you think could be a security problem ?
    I would not do that. There should NOT be any reason to edit the /includes/.htaccess file.

    Your extra scripts really need to handle security properly. Or load application_top.php to invoke Zen Cart's security handling systems. Loading configure.php directly is not advisable. I didn't mention that earlier because it sounded like you didn't care and all you wanted was just a quick dirty way of doing things without care for the proper approach.

    If you want to do it properly, use the same approach that Zen Cart uses: load a primary script from the main directory, and have it load the required additional assets after invoking application_top.php. In the case of ajax, there are many things that will be absent from your stateless connection, so you will have to write numerous additional custom scripts to handle those.

    I don't understand why you're doing all this just to send an email, nor why you're sending emails from product pages anyway. But, since you haven't explained anything about the business problem you're trying to solve by this approach, all we can do is blindly guess.
    .

    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 1 of 2 12 LastLast

Similar Threads

  1. v150 questions about code - header_php.php & main_template_vars.php
    By barricades in forum General Questions
    Replies: 3
    Last Post: 8 May 2012, 06:44 AM
  2. Integrating Code
    By darkmarauder in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 5 Apr 2011, 03:57 PM
  3. Integrating code for Shopping Comparison sites
    By riolas in forum General Questions
    Replies: 2
    Last Post: 5 Oct 2009, 07:04 AM
  4. Turbocash - anyone know about integrating with Zencart?
    By madmouse in forum General Questions
    Replies: 0
    Last Post: 25 Oct 2008, 01: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