Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2006
    Posts
    4
    Plugin Contributions
    0

    Default hide third party javascript on SSL pages

    Hi,

    Does zencart have variables that can be used to sniff out when SSL is being used to display a page? I want to use third party javascript for website tracking (think Google Analytics) but using the code triggers error messages about secure/insecure page elements.

    I'm thinking something like this from one of the zencart help pages:

    <?php if (DEFINE_CONTACT_US_STATUS <= 1) { ?>
    <li><?php echo '<a href="' . zen_href_link(FILENAME_CONTACT_US, '', 'SSL') . '">' . BOX_INFORMATION_CONTACT . '</a>'; ?></li>
    <?php } ?>

    Except instead of DEFINE_CONTACT_US_STATUS the variable would track whether the page was secure or not.

    Any help would be appreciated. Thanks!

    Tim

  2. #2
    Join Date
    May 2006
    Location
    Texas
    Posts
    565
    Plugin Contributions
    4

    Default Re: PHP to sniff secure session?

    try this:

    Code:
    <?php
    if ($request_type == 'NONSSL') {
    	//code goes here for non-ssl
    } else {
    	//if its ssl, show me this stuff
    }
    ?>

  3. #3
    Join Date
    Dec 2006
    Posts
    4
    Plugin Contributions
    0

    Default Re: PHP to sniff secure session?

    Works perfectly. Thank you!

    Tim

  4. #4
    Join Date
    Dec 2005
    Posts
    1,509
    Plugin Contributions
    6

    Default Re: PHP to sniff secure session?

    You could also use native PHP and Server vars with the following code:

    <?php // If page is SSL then use Secure Code
    if($_SERVER['HTTPS']=='on'){

    //Put your secure code here

    } else { // Else use Non-Secure Code

    // Put your non-secure code here.

    } // End if
    ?>

    I use this a lot in the footer file to show / not show various tracking systems (both on secure and non-secure pages).

    The above code will work on any PHP page to detrmine if SSL is on or not. Both Inside, and Outside of the Zen stucture.

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

    Default Re: PHP to sniff secure session?

    or you could use the secure google code
    https://secure.google.com
    Zen cart PCI compliant Hosting

  6. #6
    Join Date
    Feb 2010
    Location
    New South Wales, Australia
    Posts
    228
    Plugin Contributions
    0

    Default Re: PHP to sniff secure session?

    I know this thread is old but can someone help me with the code.

    I have included:
    <?php
    if ($request_type == 'NONSSL') {
    //code goes here for non-ssl

    <!-- Start of StatCounter Code -->
    <script type="text/javascript">
    var sc_project=2175459;
    var sc_invisible=1;
    var sc_partition=62;
    var sc_click_stat=1;
    var sc_security="dd412fa6";
    </script>

    <script type="text/javascript"
    src="http://www.statcounter.com/counter/counter.js"></script><noscript><div
    class="statcounter"><a title="website statistics"
    href="http://www.statcounter.com/" target="_blank"><img
    class="statcounter"
    src="http://c.statcounter.com/2175459/0/dd412fa6/1/"
    alt="website statistics" ></a></div></noscript>
    <!-- End of StatCounter Code -->

    } else {
    //if its ssl, show me this stuff
    }
    ?>


    in the tpl_footer.php file and then the footer on the website dissappears.
    When I have just the green section it is OK. It is only the Statcounter part. Can anyone see what is wrong.

 

 

Similar Threads

  1. email order confirmation to third party
    By valnoren in forum General Questions
    Replies: 46
    Last Post: 27 Jan 2014, 11:29 AM
  2. SSL Certificates and Processing Using Third Party
    By RtX in forum PayPal Express Checkout support
    Replies: 2
    Last Post: 29 Nov 2009, 02:02 PM
  3. Third party templates
    By travellers in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 9 Jan 2009, 03:31 PM
  4. Third Party Gift Certificate
    By BazM in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 25 Nov 2008, 11:17 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR