changeset 3:2b11de240439 draft default tip

Rewrite, better computation of dates
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Wed, 04 Jul 2012 10:33:57 -0400
parents b3ab7efb6861
children
files index.php
diffstat 1 files changed, 44 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/index.php
+++ b/index.php
@@ -1,43 +1,59 @@
+<?php
+date_default_timezone_set('America/Montreal');
+
+$day = 16;
+$endday = 20;
+$month = 07;
+$year = 2012;
+
+$octdate = getdate(mktime(8,30,0,$month,$day,$year));
+$today = getdate();
+
+$octconf = false;
+if($today['mon'] == $month && $today['mday'] >= $day
+   && $today['mday'] <= $endday){
+  $octconf = true;
+}
+
+$days = $octdate['yday'] - $today['yday'];
+
+if ($days > 1){
+  $daysstring = "$days days until OctConf 2012!!";
+}
+elseif($days == 1){
+  $daysstring = "OctConf starts tomorrow!";
+}
+elseif($octconf) {
+  $daysstring = "OctConf currently underway!";
+}
+else{
+  $daysstring = "OctConf 2012 is over... when will the next one be?";
+}
+
+?>
+
 <html>
 <head>
 <title>Is it OctConf?</title>
 </head>
 <body style="text-align: center; padding-top: 200px;">
 
-
-  <font
-    style="font-weight: bold; 
-          font-size: 120pt; 
-          font-family: Arial, sans-serif; 
-          text-decoration: none; 
+<div
+  style="font-weight: bold;
+          font-size: 120pt;
+          font-family: Arial, sans-serif;
+          text-decoration: none;
           color: black;" >
-  
- <a border="0" href="http://www.octave.org/wiki/index.php?title=OctConf_2012">
-<?php $today = getdate(); 
 
-  if($today['mon'] == 07 && $today['mday'] == 16) 
-  { 
-     echo('YES'); 
-  } else {
-	echo('NO');
-  }
-?>
+<a border="0" href="http://www.octave.org/wiki/index.php?title=OctConf_2012">
+<?= $octconf ? "YES" : "NO" ?>
 </a>
-</font>
+</div>
 
 <br><br><br>
+<?= $daysstring ?>
+<br><br><br>
 
-<?php 
-$day = 16; 
-$month = 07; 
-$year = 2012; 
-$days = (int)((mktime (0,0,0,$month,$day,$year) - time())/86400); 
-echo "$days days until OctConf 2012!!"; 
-?>
-
-
-<br><br><br>
-	
 <a href="http://www.octave.org/wiki/index.php?title=OctConf_2012"><img src ="http://jordi.platinum.linux.pl/octave/octconf-2012.png" border="0" width="800"></a>
 
 </body>