Different dates on different pages - WHY?!

software development


Hello All,

Many pages of my website, www.unavoce.ru, include the same file ~advent.shtml, like this:

<?php include('~advent.shtml'); ?>

Now ~advent.shtml is a piece of php code that is supposed to determine the date and take the relevant line from an advent.txt file (if you look at the website, you will see one of these lines on the brown field under the Una Voce Russia logo). For every day of the season of Dec 17 to Jan 25 there is supposed to be a special line, while for all the other days there is a default line.

Now I have noticed that on the front page, index.html, everything works OK but on all the other pages the line for the previous day is shown at least till 3:00 AM (well, it’s now 3:07 here and the problem is still there). Those pages include exactly the same ~advent.shtml. WHY does it work differently with them?!!

In the .htaccess, timezone is set to: SetEnv TZ Europe/Moscow

Thanks in advance. [hr]
If you want: here are the files in question.

      • ~advent.shtml
<?php $list = array(); $temp=file('advent.txt'); foreach($temp as $line) { list($key, $val) = explode(':', $line, 2); $list[$key] = $val; } $temp = date('d.m'); $temp = isset($list[$temp]) ? $list[$temp] : @$list['-----']; echo $temp; ?>
      • advent.txt

-----: Сохранение вероучительной, исторической и культурной идентичности Католической Церкви в России.
17.12: O SAPIENTIA, quae ex ore Altissimi prodiisti, attingens a fine usque ad finem, fortiter suaviterque disponens omnia: veni ad docendum nos viam prudentiae.
18.12: O ADONAI, et Dux domus Israel, qui Moysi in igne flammae rubi apparuisti, et ei in Sina legem dedisti: veni ad redimendum nos in brachio extento.
19.12: O RADIX JESSE, qui stas in signum populorum, super quem continebunt reges os suum, quem Gentes deprecabuntur: veni ad liberandum nos, jam noli tardare.
20.12: O CLAVIS DAVID, et sceptrum domus Israel; qui aperis, et nemo claudit; claudis, et nemo aperit: veni, et educ vinctum de domo carceris, sedentem in tenebris, et umbra mortis.
21.12: O ORIENS, splendor lucis aeternae, et sol justitiae: veni, et illumina sedentes in tenebris, et umbra mortis.
22.12: O REX GENTIUM, et desideratus earum, lapisque angularis, qui facis utraque unum: veni, et salva hominem, quem de limo formasti.
23.12: O EMMANUEL, Rex et legifer noster, exspectatio Gentium, et Salvator earum: veni ad salvandum nos, Domine, Deus noster.
24.12: PUER NATUS est nobis, et filius datus est nobis: cujus imperium super humerum ejus.
25.12: PUER NATUS est nobis, et filius datus est nobis: cujus imperium super humerum ejus.


.htaccess doesn’t tell PHP what time zone to use. If all of your visitors come from a known time zone, you can set that as default in your PHP code. Otherwise, you’ll need to use GeoIP to figure out where your user is and figure out the time zone from there.

Perhaps the code you need to adjust the TZ is called in your homepage but not in subsequent pages?


Thanks a lot! There really is such a line in the homepage. Didn’t know .htaccess does not affect php.