NameSilo

GetFireFox logo only displayed in IE

Spaceship Spaceship
Watch
Below is a piece of code you can add to make it so that a get firefox logo is only displayed in IE :):

PHP:
<center><?php
//Coded by JoshHendo (with a bit of help from php.net:P)
//www.joshhendo.com
//Please don't remove this notice if you use this :D
//A link back to joshhendo.com on your site is greatly appreciated
//if you use this script.
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
echo '<a href="http://getfirefox.com"><img border="0" alt="Get Firefox!" title="Get Firefox!" src=" http://sfx-images.mozilla.org/affiliates/Buttons/125x50/takebacktheweb_125x50.png"/></a>';
}
?></center>


Below is a piece of code that displays the above plus it will say underneath '<num downloads> other people have'. I did not write that code though ;)

PHP:
<center><?php
//Coded by JoshHendo (with a bit of help from php.net:P, top half only,
//not the counter)
//www.joshhendo.com
//Please don't remove this notice if you use this :D
//A link back to joshhendo.com on your site is greatly appreciated
//if you use this script.
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
echo '<a href="http://getfirefox.com"><img border="0" alt="Get Firefox!" title="Get Firefox!" src=" http://sfx-images.mozilla.org/affiliates/Buttons/125x50/takebacktheweb_125x50.png"/></a>
<br />';


$CharSet = "windows-1250";
$CssFile = "/css/style.css";


$Lang = array_key_exists("lang", $_GET) ? $_GET["lang"] : "";
if (($Lang == NULL) || ($Lang == "")) {
if (array_key_exists("HTTP_ACCEPT_LANGUAGE", $_SERVER)) $Lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2); 
else $Lang = "en";
}
if (($Lang != "en") && ($Lang != "sl")) $Lang = "en";


$StringList = array(
"downloads" => array("en" => "other people already have.", "sl" => "prenosov do sedaj"),
);


function GetNumFirefoxDownloads($Url, $Port, $Timeout) {
global $Lang;

$XmlData = file_get_contents($Url);
if ($XmlData === NULL) return "?";

global $ReturnValue;
global $IsRightTag;
$ReturnValue = "?";
$IsRightTag = false;

function XmlStartElement($Parser, $Name, $Attrs) {
global $IsRightTag;
if ($Name == "DESCRIPTION") $IsRightTag = true;
}

function XmlEndElement($Parser, $Name) {
global $IsRightTag;
if ($Name == "DESCRIPTION") $IsRightTag = false;
}

function XmlTextData($Parser, $Data) {
global $ReturnValue;
global $IsRightTag;
if ($IsRightTag) $ReturnValue = $Data;
}

$XmlParser = xml_parser_create();
xml_set_element_handler($XmlParser, "XmlStartElement", "XmlEndElement");
xml_set_character_data_handler($XmlParser, "XmlTextData");
xml_parse($XmlParser, $XmlData, true);
xml_parser_free($XmlParser);

if ($Lang == "sl") $ReturnValue = str_replace(",", ".", $ReturnValue);

return $ReturnValue;
}


$NumDownloads = GetNumFirefoxDownloads("http://feeds.spreadfirefox.com/downloads/firefox", 80, 25);


echo
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".
"<html>\n".
"<head>\n".
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$CharSet."\" />\n".
"<meta http-equiv=\"refresh\" content=\"10; url=firefoxcounter.php?lang=".$Lang."\" />\n".
"<title></title>\n".
"<link rel=\"stylesheet\" href=\"".$CssFile."\" type=\"text/css\" />\n".
"</head>\n".
"<body style=\"margin:0px;\">\n".
"<font color=\"#A0A0A0\">".$NumDownloads." ".$StringList["downloads"][$Lang]."</font>\n".
"</body>\n".
"</html>\n";
}
?>

np$ donation appreciated if used :bah:
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
I wrote my own ... you can see it at www.VibeWave.com ;) It's up by the logo at the top.

Nice script... thanks for sharing!!
 
0
•••
you could do that, but IMO this is easier:
Code:
<!--[if IE]>
<img src="whateve" />
<![endif]-->
 
0
•••
I don't think that's compatible in all browsers or servers...?
 
0
•••
But it would be compatible with IE, and that's all we need ;)
 
0
•••
Appraise.net
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back