Footer update mechanism
This commit is contained in:
parent
7c6007393b
commit
06858efcfb
|
@ -1,5 +1,5 @@
|
|||
<div id=footer class=footer>
|
||||
<div class="update"><p>Site last updated 2024-02-20 19:32:55 +1100</p></div>
|
||||
<div class="update"><p>Site last updated 2024-02-25 16:40:12 +1100</p></div>
|
||||
<div class="counter"><p>Visits:
|
||||
<?php
|
||||
session_start();
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<div id=footer class=footer>
|
||||
<div class="update"><p>Site last updated _DATE_</p></div>
|
||||
<div class="counter"><p>Visits:
|
||||
<?php
|
||||
session_start();
|
||||
if(!isset($_SESSION['counter'])) {
|
||||
$c_handle = fopen("../data/counter.txt", "r");
|
||||
if(!$c_handle){
|
||||
echo "error";
|
||||
} else {
|
||||
$counter = ( int ) fread($c_handle,32);
|
||||
fclose($c_handle);
|
||||
$counter++ ;
|
||||
echo $counter;
|
||||
$c_handle = fopen("../data/counter.txt", "w");
|
||||
fwrite($c_handle, $counter);
|
||||
fclose($c_handle);
|
||||
$_SESSION['counter'] = $counter;
|
||||
}
|
||||
} else {
|
||||
$counter = $_SESSION['counter'];
|
||||
echo $counter;
|
||||
}
|
||||
|
||||
?>
|
||||
</p></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
update_timestamp=`git show -s --format=%ci`
|
||||
update_timestamp=$(git show -s --format=%ci)
|
||||
|
||||
echo "<div id=footer class=footer>
|
||||
<p>Site last updated $update_timestamp</p>
|
||||
</div>
|
||||
" > footer.php
|
||||
sed "s/_DATE_/$update_timestamp/" footer_template.php > footer.php
|
||||
|
|
Loading…
Reference in New Issue