/    Sign up×
Community /Pin to ProfileBookmark

FF shows html source instead of page

Hi,
I have this script that I made and it works great with IE but when I try FF, the page does not render. It shows the HTML source. The HTML source is valid other that the use of the ‘<font>’ tag. I use this tag because I am not sure how to accomplish what I am doing any other way. See code. If there is another way to do this without rewriting the entire script I would like to know.

[code=php]<?PHP
include (“irlp_script.php”);
?>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<title>I.R.L.P. Status</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<meta HTTP-EQUIV=”Pragma” CONTENT=”no-cache”>
</head>
<body bgcolor=”#003573″ text=”#c1c1c1″>
<center>
I.R.L.P. Node Status<br>
<font color=”<? echo $color ?>”>
<? echo $text ?>
</font>
</center>
</body>
</html>[/code]

This next code is what is included.

[code=php]<?PHP

header(‘Content-Type: text/plain’);

// Opens the file.
$handle = fopen(‘http://status.irlp.net/nohtmlstatus.txt’ , “r”);

// Function that looks through the file for the node number.
while(!feof($handle)) {
$buffer = fgets($handle, 4096);
$pos = strpos($buffer, ‘5010’);
if ($pos !== FALSE && $pos == ‘0’)
break;
}

// Closes the file.
fclose($handle);

// Sorts the gathered data.
$buf_arr = explode(“t”, $buffer);

// Assigns the status of the node.
$irlp = $buf_arr[‘5’];

// Assigns the node owners callsign.
$owner = $buf_arr[‘1’];

// KD7BCS Node 5010.
$status = ($owner . ‘ Node 5010’ );

// Lets user know nothing was found for the node.
if($irlp == null) {
$text = (‘Sorry, there was no data found for Node 5010.’);
}

// KD7BCS Node 5010 is Idle.
elseif($irlp == ‘IDLE’) {
$text = ($status . ‘ is ‘ . $irlp);
}

// KD7BCS Node 5010 is Offline.
elseif($irlp == ‘OFFLINE’) {
$text = ($status . ‘ is ‘ . $irlp);
}

// KD7BCS Node 5010 is Down.
elseif($irlp == ‘DOWN’) {
$text = ($status . ‘ is ‘ . $irlp);
}

// KD7BCS Node 5010 is Busy.
elseif($irlp == ‘BUSY’) {
$text = ($status . ‘ is ‘ . $irlp);
}

// KD7BCS Node 5010 is connected to Node 7160.
elseif($irlp < ‘9000’) {
$text = ($status . ‘ is connected to Node ‘ . $irlp);
}

// KD7BCS Node 5010 is connected to Reflecter 9453.
elseif($irlp > ‘8999’) {
$text = ($status . ‘ is connected to Reflecter ‘ . $irlp);
}

// This section assigns the color of the text based on what data was retrieved.
if($irlp == null) {
$color = ‘#33CCFF’;
}
elseif($irlp == ‘IDLE’) {
$color = ‘#00FF00’;
}
elseif($irlp == ‘OFFLINE’) {
$color = ‘#FF0000’;
}
elseif($irlp == ‘BUSY’) {
$color = ‘#FF0000’;
}
elseif($irlp == ‘DOWN’) {
$color = ‘#FF0000’;
}
elseif($irlp < ‘9000’) {
$color = ‘#FF0000’;
}
elseif($irlp > ‘8999’) {
$color = ‘#FFFF00’;
}
?>[/code]

Any help would be appriciated

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@the_treeAug 17.2005 — header('Content-Type: text/plain');[/quote]That'd be your problem. Changing that to [i]text/html[/i] will tell your browser to treat it as an HTML document rather than a text document.
Copy linkTweet thisAlerts:
@the_treeAug 17.2005 — While your at it, have you tried switch statements? They can be a lot neater than loads of ifelses.[code=php]// Determines Message and color.
switch ($irlp){
case null:
$text = 'Sorry, there was no data found for Node 5010';
$color = '#3cf';
break;

case 'IDLE':
$text = "$status is $irlp";
$color = '#0f0'
break;

case 'OFFLINE':
case 'DOWN':
case 'BUSY':
$text = "$status is $irlp";
$color = '#f00';
break;

default:
if ($irlp << '9000'){
$text = "$status is connected to Node $irlp";
$color = '#f00';
}elseif($irlp >> '8999'){
$text = "$status is connected to Reflecter $irlp";
$color = '#ff0';
}
break;

}
[/code]
Copy linkTweet thisAlerts:
@towerboyauthorAug 17.2005 — Thank you very much. After I posted, I thought that might be the cause.

the tree,

no I haven't tried switch statements. I think I will be changing those when I get a chance.
×

Success!

Help @towerboy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...