Would someone take a look at this please, what I am trying to do is include this php file a hit counter:
Code:
<?php
$COUNT_FILE = "../data/count_data.txt";
$IMG_DIR_URL = "../images/digits/";
$NB_DIGITS = 8;
if (file_exists($COUNT_FILE)) {
// Open, read, increment, save and close file.
$fp = fopen("$COUNT_FILE", "r+");
flock($fp, 1);
$count = fgets($fp, 4096);
$count += 1;
fseek($fp,0);
fputs($fp, $count);
flock($fp, 3);
fclose($fp);
} else {
//Display a error message if file does not exist.
echo "Can't find file, check '\$file' var...<BR>";
exit;
}
chop($count);
$nb_digits = max(strlen($count), $NB_DIGITS);
$count = substr("0000000000".$count, -$nb_digits);
$digits = preg_split("//", $count);
for($i = 0; $i <= $nb_digits; $i++) {
if ($digits[$i] != "") {
$html_result .= "<IMG SRC=\"$IMG_DIR_URL$digits[$i].gif\">";
}
}
echo $html_result;
?>
into this index.html file
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>test</title>
<link type="text/css" rel="stylesheet" href="templ/styles.css"/>
</head>
<body>
<div class="banner">
<img src="images/lordtitle.jpg" class="lordMainImg"/>
</div>
<div class="div1" style="overflow:hidden; height:25px; padding-top:3px;">
<marquee>
<script>
zerosandOnes();
</script>
</marquee>
</div>
<div class="div1">
<p class="intro">some text here<p>
</div>
<div class="div1" style="margin-top:100px;">
<a href="theTemple.html">enter</a><a href="http://www.google.com" style="padding-left:15px;">exit</a>
</div>
<?php include('php/count.php'); ?>
<div class="banner" style="margin-top:60px;">
<img src="images/sub.gif" class="subApache"/>
<img src="images/banner3.gif" class="subBSD"/>
</div>
</body>
</html>
I have tried like you see above and also with renaming the file index.php.Apache does not seem to serve my php page to me as index.php.I have looked through httpd.conf for a way to do this, maybe I missed it..What I would really like is for the php file to be included as I am trying and the hit counter to be displayed.Could someone help me please?