Menu
Hello all,
I have a few different text files in different directories. Each text file contains a different number. I would like to be able to open a web page and see the result of the addition of the numbers in the text files. Is this possible to do?
Thanks so much
[code=php]
$files = array('file1.txt', 'file2.txt', 'file3.txt'); //etc
$result = 0;
foreach ($files as $file) {
$lines = file($file);
$result += intval($lines[0]); // assuming your number is an integer
}
echo $result;
[/code]
[code=php]
foreach ($files as $file) {
$result += (int)trim(file_get_contents($file));
}
[/code]
Instead of breaking each file into an array of lines, I'd just do:
[code=php]
[/QUOTE]
foreach ($files as $file) {
$result += (int)trim(file_get_contents($file));
}
[/code]
foreach($array as $key)
foreach($array as $key=>$value)
[code=php]foreach ($files as $index) {
$result += (int)trim(file_get_contents($files[$index]));
}
//OR
foreach ($files as $key=>$file) {
$result += (int)trim(file_get_contents($file));
}[/code]
foreach ($array as $value);
foreach ($array as $key=>$value);
[code=php]$files = array('file1.txt', 'file2.txt', 'file3.txt');
foreach ($files as $file) {
echo $file . '<br />';
}[/code]
file1.txt
file2.txt
file3.txt
...
NogDog's code works fine (assuming that this number is the only item in the file - I assumed it wasn't which is why I broke it down in into lines)[/QUOTE]
Nope, it works in the following 2 ways:
foreach ($array as $value);
foreach ($array as $key=>$value);
Consider the following:
[code=php]$files = array('file1.txt', 'file2.txt', 'file3.txt');
foreach ($files as $file) {
echo $file . '<br />';
}[/code]
Produces:
file1.txt
file2.txt
file3.txt
NogDog's code works fine (assuming that this number is the only item in the file - I assumed it wasn't which is why I broke it down in into lines)[/QUOTE]
<i>
</i><?php putenv("TZ=America/Los_Angeles"); ?>
<?
$step=$HTTP_GET_VARS["step"];
if($step == "showrefs") {
$process=$HTTP_GET_VARS["process"];
$date=$HTTP_GET_VARS["date"];
print "<u><font face=verdana size=2><b>Referers for $date</b></font></u><br><br>";
if($process == "getrawreferers") {
$filenamereferers="logs/".$date."_referers_raw";
}
if($process == "getuniquereferers") {
$filenamereferers="logs/".$date."_referers_unique";
}
if($process == "getuniquereferers_thismonth") {
$filenamereferers="logs/".$date."_allreferers_unique";
}
if($process == "getrawreferers_thismonth") {
$filenamereferers="logs/".$date."_allreferers_raw";
}
$filecontents=ParseFile("$filenamereferers");
$array = split("n", $filecontents);
$count = count($array);
for ($i=0; $i<=$count; $i++)
{
echo "<a href="$array[$i]" target="_blank"><font face=verdana size=2>$array[$i]</font></a><br>"; // add appropiate HTML tags here
}
exit;
}
$month=$HTTP_POST_VARS['monthdrop'];
$year=$HTTP_POST_VARS['yeardrop'];
if(empty($month) or empty($year)) {
$month=date("m");
$year=date("Y");
}
if($month == "04" or $month == "06" or $month == "09" or $month == "11") {
$datemax="30";
}
if($month == "01" or $month == "03" or $month == "05" or $month == "07" or $month == "08" or $month == "10" or $month == "12") {
$datemax="31";
}
if($month == "02") {
if($year == "2004" or $year == "2008" or $year == "2012" or $year == "2016" or $year == "2020" or $year == "2024" or $year == "2028" or $year == "2032") {
$datemax=29;
}
else {
$datemax=28;
}
}
$totaluniquehits=0;
$totalrawhits=0;
if(file_exists("logs/alltotal_unique")) {
$totaluniquesall=ParseFile("logs/alltotal_unique");
}
else {
$totaluniquesall=0;
}
if(file_exists("logs/alltotal_raw")) {
$totalrawsall=ParseFile("logs/alltotal_raw");
}
else {
$totalrawsall=0;
}
?>
<html>
<head>
<title>Stats</title>
</head>
<body bgcolor="#ffffff">
<table width="400" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td height="45" bgcolor="black" border="0" bordercolor="black"><div align="center"><font color="#FFFFFF" size="4" face="Verdana, Arial, Helvetica, sans-serif">
Touched/Opened Statistics<br>Hotels - Page 1 - Ad 1</font><br><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Ad Locator Number: AAA00001</font></div></td>
</tr>
</table>
<form method="POST" action="index.php">
<p align="center"><b><font size="2" face="Verdana">Year: </font></b><font face="Verdana"><b>
<select size="1" name="yeardrop">
<?
$todaysyear=date("Y");
for($i=2007;$i<=$todaysyear;$i++) {
if($i==$year) {
echo "<option selected>$i</option>";
}
else {
echo "<option>$i</option>";
}
}
?>
</select>
<b><font size="2" face="Verdana"> &nbsp;&nbsp;Month: </font></b>
<select size="1" name="monthdrop">
<?
$todaysyear=date("Y");
for($i=1;$i<=12;$i++) {
if($i<=9) {
$k='0'.$i;
}
else {
$k=$i;
}
if($k==$month) {
echo "<option selected>$k</option>";
}
else {
echo "<option>$k</option>";
}
}
?>
</select>
</b></font><b><font size="2" face="Verdana">&nbsp;&nbsp; </font></b><font face="Verdana"><b>
<input type="submit" value="Go" name="B1">
</b></font></p>
</form>
<table border="0" align="center" cellspacing="0" >
<tr>
<td align="center"><font size="1" face="Verdana">12:00:00 am - 11:59:59 pm PST<br>(Pacific Standard Time)</font><br><br></td>
</tr>
</table>
<div align="center">
<center>
<table border="1" cellspacing="3" style="border-collapse: collapse" bordercolor="#ffffff" width="180" id="AutoNumber1" height="50">
<tr>
<td width="115" bgcolor="#E2E2E2" align="center" height="21"><b>
<font size="1" face="Verdana">Date</font></b></td>
<td width="65" bgcolor="#E2E2E2" align="center" height="21"><b>
<font size="1" face="Verdana">Hits</font></b></td>
</tr>
<?
for($j=1;$j<=$datemax;$j++) {
if($j<=9) {
$m='0'.$j;
}
else {
$m=$j;
}
$dateeveryday=$year."-".$month."-".$m;
$datethismonth=$year."-".$month;
$filename_raw='logs/'.$dateeveryday."_raw";
$filename_unique='logs/'.$dateeveryday."_unique";
if(file_exists($filename_raw)) {
$rawhits=ParseFile($filename_raw);
}
else {
$rawhits="0";
}
if(file_exists($filename_unique)) {
$uniquehits=ParseFile($filename_unique);
}
else {
$uniquehits="0";
}
$totaluniquehits=$totaluniquehits+$uniquehits;
$totalrawhits=$totalrawhits+$rawhits;
echo " <br/>
<tr>
<td width="115" height="15" align="center"><font face=verdana size=2>$dateeveryday</font></td>
<td width="65" height="15" align="center"><font face=verdana size=2>$rawhits</a></font></td>
</tr>";
}
echo "
<i> </i><tr>
<i> </i> <td width="115" height="25" align="center"><font face=verdana size=2><b>Monthly Total:</b></font></td>
<i> </i> <td width="65" height="25" align="center"><font face=verdana size=2><b>$totalrawhits</a></b></font></td>
<i> </i></tr>";
?>
</table>
<center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="180" id="AutoNumber1">
<tr>
<td width="115" align="center"><b><font size="2" face="Verdana">Grand Total: </font></b></td>
<td width="65" align="center"><font size="2" face="Verdana"><b><? echo $totalrawsall; ?></b></font></td>
</tr>
</table>
</center>
</center>
</div>
<br>
<table width="350" border="0" align="center">
<tr><td><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">
We warrant that all airings and connections are valid and correct. <br><br><img src="http://www.info-centres.com/images/sig.jpg">Management
</font></td></tr></table>
</body>
</html>
<?
##This function opens a file and returns its contents to the caller
function ParseFile ($filename)
{
if(!file_exists($filename)) {
print "<center><font size=1 face=verdana><b>Nothing found in the file</center></font>";
exit;
}
else {
if(is_readable($filename)) {
$handle=fopen($filename,"r");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
return $contents;
}
else {
print "<center><font size=1 face=verdana>Unable to open the file: <b>$filename</b>. <br>File is found in the specified directory but it has not been possible to open it. <br>This may be a permission problem. Please set permission of this file to : <b>644</b>";
exit;
}
}
}
?>
2008-11-22 35
2008-11-23 56
etc
[code=php]$data = array();
$dir_con = opendir('.');// current dir
while(FALSE !== ($subDir = readdir($dir_con))){
if(substr($subDir, 0, 1) != '.' && is_dir($subDir)){// it's a dir we want
$subDirCon = opendir($subDir);
while(FALSE !== ($file = readdir($subDirCon))){// for every file
if( !is_dir($subDir.'/'.$file)){
list($date) = explode('_', $file);// get the date
if( ! isset($data[$date]))
$data[$date] = 0;// init to 0
$data[$date] += (int) trim(file_get_contents($subDir.'/'.$file));
}
}
closedir($subDirCon);
}
}
closedir($dir_con);
// then to display the info:
foreach($data as $date=>$total){
echo "<p>{$date} : {$total}</p>";
}
[/code]
[code=php]
<?php
/**
* Get log totals for given date
* @return integer
* @param string $date "yyyy-mm-dd"
*/
function getCountForDate($date)
{
$total = 0;
$logs = glob('/path/to/log/files/logs*/' . $date . '_raw');
foreach($logs as $log)
{
$total += (int) trim(file_get_contents($log));
}
return $total;
}
// sample usage:
echo "<p>Total for 2008-11-22: " . getCountForDate('2008-11-22') . "</p>n";
[/code]
<i>
</i><?php putenv("TZ=America/Los_Angeles"); ?>
<?
$step=$HTTP_GET_VARS["step"];
if($step == "showrefs") {
$process=$HTTP_GET_VARS["process"];
$date=$HTTP_GET_VARS["date"];
print "<u><font face=verdana size=2><b>Referers for $date</b></font></u><br><br>";
if($process == "getrawreferers") {
$filenamereferers="logs/".$date."_referers_raw";
}
if($process == "getuniquereferers") {
$filenamereferers="logs/".$date."_referers_unique";
}
if($process == "getuniquereferers_thismonth") {
$filenamereferers="logs/".$date."_allreferers_unique";
}
if($process == "getrawreferers_thismonth") {
$filenamereferers="logs/".$date."_allreferers_raw";
}
$filecontents=ParseFile("$filenamereferers");
$array = split("n", $filecontents);
$count = count($array);
for ($i=0; $i<=$count; $i++)
{
echo "<a href="$array[$i]" target="_blank"><font face=verdana size=2>$array[$i]</font></a><br>"; // add appropiate HTML tags here
}
exit;
}
$month=$HTTP_POST_VARS['monthdrop'];
$year=$HTTP_POST_VARS['yeardrop'];
if(empty($month) or empty($year)) {
$month=date("m");
$year=date("Y");
}
if($month == "04" or $month == "06" or $month == "09" or $month == "11") {
$datemax="30";
}
if($month == "01" or $month == "03" or $month == "05" or $month == "07" or $month == "08" or $month == "10" or $month == "12") {
$datemax="31";
}
if($month == "02") {
if($year == "2004" or $year == "2008" or $year == "2012" or $year == "2016" or $year == "2020" or $year == "2024" or $year == "2028" or $year == "2032") {
$datemax=29;
}
else {
$datemax=28;
}
}
$totaluniquehits=0;
$totalrawhits=0;
if(file_exists("logs/alltotal_unique")) {
$totaluniquesall=ParseFile("logs/alltotal_unique");
}
else {
$totaluniquesall=0;
}
if(file_exists("logs/alltotal_raw")) {
$totalrawsall=ParseFile("logs/alltotal_raw");
}
else {
$totalrawsall=0;
}
?>
<html>
<head>
<title>Stats</title>
</head>
<body bgcolor="#ffffff">
<table width="400" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td height="45" bgcolor="black" border="0" bordercolor="black"><div align="center"><font color="#FFFFFF" size="4" face="Verdana, Arial, Helvetica, sans-serif">
Touched/Opened Statistics<br>Hotels - Page 1 - Ad 1</font><br><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Ad Locator Number: AAA00001</font></div></td>
</tr>
</table>
<form method="POST" action="index.php">
<p align="center"><b><font size="2" face="Verdana">Year: </font></b><font face="Verdana"><b>
<select size="1" name="yeardrop">
<?
$todaysyear=date("Y");
for($i=2007;$i<=$todaysyear;$i++) {
if($i==$year) {
echo "<option selected>$i</option>";
}
else {
echo "<option>$i</option>";
}
}
?>
</select>
<b><font size="2" face="Verdana"> &nbsp;&nbsp;Month: </font></b>
<select size="1" name="monthdrop">
<?
$todaysyear=date("Y");
for($i=1;$i<=12;$i++) {
if($i<=9) {
$k='0'.$i;
}
else {
$k=$i;
}
if($k==$month) {
echo "<option selected>$k</option>";
}
else {
echo "<option>$k</option>";
}
}
?>
</select>
</b></font><b><font size="2" face="Verdana">&nbsp;&nbsp; </font></b><font face="Verdana"><b>
<input type="submit" value="Go" name="B1">
</b></font></p>
</form>
<table border="0" align="center" cellspacing="0" >
<tr>
<td align="center"><font size="1" face="Verdana">12:00:00 am - 11:59:59 pm PST<br>(Pacific Standard Time)</font><br><br></td>
</tr>
</table>
<div align="center">
<center>
<table border="1" cellspacing="3" style="border-collapse: collapse" bordercolor="#ffffff" width="180" id="AutoNumber1" height="50">
<tr>
<td width="115" bgcolor="#E2E2E2" align="center" height="21"><b>
<font size="1" face="Verdana">Date</font></b></td>
<td width="65" bgcolor="#E2E2E2" align="center" height="21"><b>
<font size="1" face="Verdana">Hits</font></b></td>
</tr>
<?
for($j=1;$j<=$datemax;$j++) {
if($j<=9) {
$m='0'.$j;
}
else {
$m=$j;
}
$dateeveryday=$year."-".$month."-".$m;
$datethismonth=$year."-".$month;
$filename_raw='logs/'.$dateeveryday."_raw";
$filename_unique='logs/'.$dateeveryday."_unique";
if(file_exists($filename_raw)) {
$rawhits=ParseFile($filename_raw);
}
else {
$rawhits="0";
}
if(file_exists($filename_unique)) {
$uniquehits=ParseFile($filename_unique);
}
else {
$uniquehits="0";
}
$totaluniquehits=$totaluniquehits+$uniquehits;
$totalrawhits=$totalrawhits+$rawhits;
echo " <br/>
<tr>
<td width="115" height="15" align="center"><font face=verdana size=2>$dateeveryday</font></td>
<td width="65" height="15" align="center"><font face=verdana size=2>$rawhits</a></font></td>
</tr>";
}
echo "
<i> </i><tr>
<i> </i> <td width="115" height="25" align="center"><font face=verdana size=2><b>Monthly Total:</b></font></td>
<i> </i> <td width="65" height="25" align="center"><font face=verdana size=2><b>$totalrawhits</a></b></font></td>
<i> </i></tr>";
?>
</table>
<center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="180" id="AutoNumber1">
<tr>
<td width="115" align="center"><b><font size="2" face="Verdana">Grand Total: </font></b></td>
<td width="65" align="center"><font size="2" face="Verdana"><b><? echo $totalrawsall; ?></b></font></td>
</tr>
</table>
</center>
</center>
</div>
<br>
<table width="350" border="0" align="center">
<tr><td><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">
We warrant that all airings and connections are valid and correct. <br><br><img src="http://www.info-centres.com/images/sig.jpg">Management
</font></td></tr></table>
</body>
</html>
<?
##This function opens a file and returns its contents to the caller
function ParseFile ($filename)
{
if(!file_exists($filename)) {
print "<center><font size=1 face=verdana><b>Nothing found in the file</center></font>";
exit;
}
else {
if(is_readable($filename)) {
$handle=fopen($filename,"r");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
return $contents;
}
else {
print "<center><font size=1 face=verdana>Unable to open the file: <b>$filename</b>. <br>File is found in the specified directory but it has not been possible to open it. <br>This may be a permission problem. Please set permission of this file to : <b>644</b>";
exit;
}
}
}
?>
The only problem is that we have roughly 800 counters (and many more to come) to keep track of...and changing the code now would really make my boss mad :-([/quote]
[code=php]<?php
// parse file returning an array of info for day, month and total
function parse_log ($filename, $date) {
// ensure log file exists
if (!file_exists($filename)) return false;
// ensure valid date was passed
if (preg_match("/^(d{4})-(d{2})-(d{2})$/", $date, $matches)) {
if (!checkdate($matches[2], $matches[3], $matches[1])) {
return false;
}
} else {
return false;
}
$dateparts = explode('-', $date);
$start = mktime(0, 0, 0, $dateparts[1], 1, $dateparts[0]);
$end = mktime(0, 0, 0, $dateparts[1], date('t', $start), $dateparts[0]);
// read the file into an array line by line
$lines = file($filename);
// parse each line
foreach ($lines as $line) {
$parts = explode(' ', $line);
$parsed[$parts[0]] = (int)$parts[1];
// get an array containing just the months data too
$timestamp = strtotime($parts[0]);
if ($timestamp >= $start && $timestamp <= $end) {
$parsed_month[$parts[0]] = (int)$parts[1];
}
}
$results['day'] = $parsed[$date];
$results['total'] = array_sum($parsed);
$results['month'] = array_sum($parsed_month);
return $results;
}
$result = parse_log('log_raw', '2008-11-23');
print_r($result);
// results in Array ( [day] => 14 [total] => 93 [month] => 67 )
?>[/code]
<i>
</i><?php putenv("TZ=America/Los_Angeles"); ?>
<?
$step=$HTTP_GET_VARS["step"];
if($step == "showrefs") {
$process=$HTTP_GET_VARS["process"];
$date=$HTTP_GET_VARS["date"];
print "<u><font face=verdana size=2><b>Referers for $date</b></font></u><br><br>";
if($process == "getrawreferers") {
$filenamereferers="logs/".$date."_referers_raw";
}
if($process == "getuniquereferers") {
$filenamereferers="logs/".$date."_referers_unique";
}
if($process == "getuniquereferers_thismonth") {
$filenamereferers="logs/".$date."_allreferers_unique";
}
if($process == "getrawreferers_thismonth") {
$filenamereferers="logs/".$date."_allreferers_raw";
}
$filecontents=ParseFile("$filenamereferers");
$array = split("n", $filecontents);
$count = count($array);
for ($i=0; $i<=$count; $i++)
{
echo "<a href="$array[$i]" target="_blank"><font face=verdana size=2>$array[$i]</font></a><br>"; // add appropiate HTML tags here
}
exit;
}
$month=$HTTP_POST_VARS['monthdrop'];
$year=$HTTP_POST_VARS['yeardrop'];
if(empty($month) or empty($year)) {
$month=date("m");
$year=date("Y");
}
if($month == "04" or $month == "06" or $month == "09" or $month == "11") {
$datemax="30";
}
if($month == "01" or $month == "03" or $month == "05" or $month == "07" or $month == "08" or $month == "10" or $month == "12") {
$datemax="31";
}
if($month == "02") {
if($year == "2004" or $year == "2008" or $year == "2012" or $year == "2016" or $year == "2020" or $year == "2024" or $year == "2028" or $year == "2032") {
$datemax=29;
}
else {
$datemax=28;
}
}
$totaluniquehits=0;
$totalrawhits=0;
if(file_exists("logs/alltotal_unique")) {
$totaluniquesall=ParseFile("logs/alltotal_unique");
}
else {
$totaluniquesall=0;
}
[COLOR="DeepSkyBlue"]$files = array('http://www.something.com/admin/administrators/canada/bc/vancouver/via_rail/ad_counters/hotels/hotels_p1_1/logs/alltotal_raw', 'http://www.something.com/admin/administrators/canada/bc/vancouver/via_rail/ad_counters/hotels/hotels_p1_2/logs/alltotal_raw', 'http://www.something.com/admin/administrators/canada/bc/vancouver/via_rail/ad_counters/hotels/hotels_p1_3/logs/alltotal_raw', 'http://www.something.com/admin/administrators/canada/bc/vancouver/via_rail/ad_counters/hotels/hotels_p1_4/logs/alltotal_raw', 'http://www.something.com/admin/administrators/canada/bc/vancouver/via_rail/ad_counters/hotels/hotels_p1_5/logs/alltotal_raw', 'http://www.something.com/admin/administrators/canada/bc/vancouver/via_rail/ad_counters/hotels/hotels_p1_6/logs/alltotal_raw', 'http://www.something.com/admin/administrators/canada/bc/vancouver/via_rail/ad_counters/hotels/hotels_p1_7/logs/alltotal_raw');
$totalrawsall = 0;
foreach ($files as $file) {
$lines = file($file);
$totalrawsall += intval($lines[0]);
}[/COLOR]
?>
<html>
<head>
<title>Stats</title>
</head>
<body bgcolor="#ffffff">
<table width="400" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td height="35" bgcolor="black" border="0" bordercolor="black"><div align="center"><font color="#FFFFFF" size="4" face="Verdana, Arial, Helvetica, sans-serif">
Touched/Opened Totals</font></div></td>
</tr>
</table>
<form method="POST" action="index.php">
<p align="center"><b><font size="2" face="Verdana">Year: </font></b><font face="Verdana"><b>
<select size="1" name="yeardrop">
<?
$todaysyear=date("Y");
for($i=2007;$i<=$todaysyear;$i++) {
if($i==$year) {
echo "<option selected>$i</option>";
}
else {
echo "<option>$i</option>";
}
}
?>
</select>
<b><font size="2" face="Verdana"> &nbsp;&nbsp;Month: </font></b>
<select size="1" name="monthdrop">
<?
$todaysyear=date("Y");
for($i=1;$i<=12;$i++) {
if($i<=9) {
$k='0'.$i;
}
else {
$k=$i;
}
if($k==$month) {
echo "<option selected>$k</option>";
}
else {
echo "<option>$k</option>";
}
}
?>
</select>
</b></font><b><font size="2" face="Verdana">&nbsp;&nbsp; </font></b><font face="Verdana"><b>
<input type="submit" value="Go" name="B1">
</b></font></p>
</form>
<table border="0" align="center" cellspacing="0" >
<tr>
<td align="center"><font size="1" face="Verdana">12:00:00 am - 11:59:59 pm PST<br>(Pacific Standard Time)</font><br><br></td>
</tr>
</table>
<div align="center">
<center>
<table border="1" cellspacing="3" style="border-collapse: collapse" bordercolor="#ffffff" width="180" id="AutoNumber1" height="50">
<tr>
<td width="115" bgcolor="#E2E2E2" align="center" height="21"><b>
<font size="1" face="Verdana">Date</font></b></td>
<td width="65" bgcolor="#E2E2E2" align="center" height="21"><b>
<font size="1" face="Verdana">Hits</font></b></td>
</tr>
<?
for($j=1;$j<=$datemax;$j++) {
if($j<=9) {
$m='0'.$j;
}
else {
$m=$j;
}
[COLOR="Red"]$dateeveryday=$year."-".$month."-".$m;
$datethismonth=$year."-".$month;
$filename_raw='logs/'.$dateeveryday."_raw";
if(file_exists($filename_raw)) {
$rawhits=ParseFile($filename_raw);
}
else {
$rawhits="0";
}
$totalrawhits=$totalrawhits+$rawhits;[/COLOR]
echo " <br/>
<tr>
<td width="115" height="15" align="center"><font face=verdana size=2>$dateeveryday</font></td>
<td width="65" height="15" align="center"><font face=verdana size=2>$rawhits</a></font></td>
</tr>";
}
echo "
<i> </i><tr>
<i> </i> <td width="115" height="25" align="center"><font face=verdana size=2><b>Monthly Total:</b></font></td>
<i> </i> <td width="65" height="25" align="center"><font face=verdana size=2><b>$totalrawhits</a></b></font></td>
<i> </i></tr>";
?>
</table>
<center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="180" id="AutoNumber1">
<tr>
<td width="115" align="center"><b><font size="2" face="Verdana">Grand Total: </font></b></td>
<td width="65" align="center"><font size="2" face="Verdana"><b><? echo $totalrawsall; ?></b></font></td>
</tr>
</table>
</center>
</center>
</div>
</body>
</html>
<?
##This function opens a file and returns its contents to the caller
function ParseFile ($filename)
{
if(!file_exists($filename)) {
print "<center><font size=1 face=verdana><b>Nothing found in the file</center></font>";
exit;
}
else {
if(is_readable($filename)) {
$handle=fopen($filename,"r");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
return $contents;
}
else {
print "<center><font size=1 face=verdana>Unable to open the file: <b>$filename</b>. <br>File is found in the specified directory but it has not been possible to open it. <br>This may be a permission problem. Please set permission of this file to : <b>644</b>";
exit;
}
}
}
?>
0.1.9 — BETA 6.16