Hi,
The code for the php works fine, however to try to locate the problem I reduced it to just the following:
Code: Select all
01//counter.php
02 <?php
03 echo "Hello";
04 ?>
This worked when run directly from the browser (displaying 'Hello'), but produced nothing from within the webpage.
The web page is as follows;
count.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Pragma" content="no-cache" />
<title>Download Counter</title>
<link rel="stylesheet" type="text/css" href="files/mstyle.css" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="files/ie.css" />
<![endif]-->
<link rel="stylesheet" href="files/styles.css" type="text/css" />
</head>
<body>
<div id="wrap">
<div class="wrap_corner_right">
<div id="topcontent">
<div id="body" class="plain">
<h1>Download counts:</h1>
<table width="90%" border="0" cellspacing="0" cellpadding="5" align="center">
<tr>
<td width="50%"> Link 1: <script language="php" src="counter.php?id=1"><!-- //--></script></td>
<td width="50%"> Link 2: <script language="php" src="counter.php?id=2"><!-- //--></script></td>
</tr>
<tr>
<td width="50%"> Link 3: <script language="php" src="counter.php?id=3"><!-- //--></script></td>
<td width="50%"> Link 4: <script language="php" src="counter.php?id=4"><!-- //--></script></td>
</tr>
</table>
<br>
</div>
</div>
<div id="bottomcontent">
<div class="bottomcontent_right">
</div>
</div>
</div>
</div>
</body>
</html>
I confess to knowing nothing about headers, content-types and doctypes, those used were specified by the previous (former) employee who is no longer available to provide any answers. I'm assuming there is something wrong with the html as the php works on it's own.
In case it's necessary, and so everyone can see how bad my first script it, here is the proper code for counter.php as well:
Code: Select all
<?php
$pid = $_GET['id'];
$lines = file('777/counters.txt');
$value = '0';
$donated = '0';
foreach ($lines as $thisline)
{
$thisline = trim($thisline);
list( $id, $count, $amount, $description )=explode('_',$thisline);
if ( $id == $pid )
{
$value = $count;
$donated = $amount;
}
}
$formatted = number_format($donated, 2, '.', ',');
$strg = "".$value." (p".$formatted.") ";
$numbs = str_split ($strg);
$html = "";
foreach ($numbs as $key)
{
if ( $key == "(" ) { $key = "bl"; }
if ( $key == ")" ) { $key = "br"; }
if ( $key == " " ) { $key = "space"; }
if ( $key == "." ) { $key = "dot"; }
if ( $key == "," ) { $key = "comma"; }
echo "<img src=\"images/$key.gif\">";
}
exit();
?>
The output is graphical representations of (combinations of) 0-9, left bracket, right bracket, space, period and comma.
Thanks for any help. In case it's relevant, this is running on W7 (x64), IIS7.5, Intel Core2 Quad 2.83GHz, 8Gb RAM, 16Tb HDD.
Oh, BTW, if there is a glaringly obvious error, please don't just point it out, tell me how to fix it too!