Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Amber alert javascript


TXprogrammer

Recommended Posts

Posted

I added the amber alert javascript to my site and now I get a security message window on every https page. My knowledge in php is limited. Is there a way to make it so this does not happen, even if I have to supress the script on the https pages?

Here is the code now:

<!-- Begin Code Amber Ticker code. -->
<P ALIGN=CENTER>
<script LANGUAGE="JavaScript1.2" src="http://www.codeamber.org/js/hcodea.js">
</script>
</P>
<!-- end of Code Amber Ticker code (c)Copyright codeamber.org 2002, 2003, 2004-->

It is in the header so it will show up on every page.

 

BIG THNX!! :)

Everybody be quiet, the voices in my head are trying to tell me something!

Posted

create a new file called amberalert.js in dir catelog/includes

 

and put this inside it

 

<!-- Begin
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4))  {
document.write('<script LANGUAGE="JavaScript1.2" src="http://www.codeamber.com/js/hiecodea.js"></script>');
     }
    else {
document.write('<script LANGUAGE="JavaScript1.2" src="http://www.codeamber.com/js/hnscodea.js"></script>');
 }
// end -->

 

then call it with this code

<!-- Begin Code Amber Ticker code. -->
<P ALIGN=CENTER>
<script LANGUAGE="JavaScript1.2" src="includes/amberalert.js">
</script>
</P>
<!-- end of Code Amber Ticker code (c)Copyright codeamber.org 2002, 2003, 2004-->

 

instead of

 

<!-- Begin Code Amber Ticker code. -->
<P ALIGN=CENTER>
<script LANGUAGE="JavaScript1.2" src="http://www.codeamber.org/js/hcodea.js">
</script>
</P>
<!-- end of Code Amber Ticker code (c)Copyright codeamber.org 2002, 2003, 2004-->

 

that should work fine.

 

let me know if it works.

K Groner

Posted

I'm sure there's a way within PHP to determine whether you're using HTTPS or not - you could then create an if statement around that amber code.

 

Something like:

<?php

if (substr_count($PHP_SELF, 'https')<1){

?>

amber code here

<?php

}

?>

continue the page here

 

I'm not sure if $PHP_SELF includes the http or https - but that substr_count function above should return the number of times the string "https" appears in $PHP_SELF - if it's less than 1 (ie, none) then the amber code will run.

Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Posted

You can also use this.

 

<php?
if ($request_type != 'SSL') {   //disable this script if using ssl
 
?>

<!-- Begin Code Amber Ticker code. -->
<P ALIGN=CENTER>
<script LANGUAGE="JavaScript1.2" src="http://www.codeamber.org/js/hcodea.js">
</script>
</P>
<!-- end of Code Amber Ticker code (c)Copyright codeamber.org 2002, 2003, 2004-->

<php?
}  // end of ssl 
?>

while (!succeed) {try()};

 

GMT -6:00

Posted

still got the error with kngrnr code, then added TomThumb and still got error, then changed TomThumb

<PHP?

to

<?PHP

and it then worked.

 

THNX to all!

:D

Everybody be quiet, the voices in my head are trying to tell me something!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...