i'm trying to create a counter of my website visit and i did something like this:
contatore.txt: 0
index.html:
<html><head>
</head>
<body>
<p><?php include ("counter.php"); ?></p>
</body></html>
counter.php:
<?php
$file_handle = fopen("contatore.txt", "r");
$line = ((int)(fgets($file_handle))) + 1;
fclose($file_handle);
$fh = fopen( 'filelist.txt', 'w' );
fwrite($fh, (string)($line));
fclose($fh);
echo ((string)($line));
?>
here is the problem: the browser just auto hide the php code usin :( can you help me?? thanks
Your file is named index.html
. Unless you told your server that .html files should be treated as PHP scripts, that means the PHP code is NOT being executed - it's going out as literal text. And since PHP tags make it look like HTML, your browser is properly hiding that unknown/illegal tag.
Rename it to index.php
.