- file_get_contents: documentation ( source)
- json_decode: documentation ( source)
- json_encode: documentation ( source)
- file_put_contents: documentation ( source)
- header: documentation ( source)
<?php
if(isset($_GET['stats'])) {
$stats = json_decode(file_get_contents('stats.json'));
echo '<h1>Hits: '.$stats->hits.'</h1>';
echo "STATS WAS SET";
} else {
// STATS WAS NOT SET
$stats = json_decode(file_get_contents('stats.json'));
$stats->hits++;
file_put_contents('stats.json', json_encode($stats));
echo "STATS WAS NOT SET";
header("Location: http://www.bjcstcharlescounty.org/");
}
?>