Old stuff/old_sites/appo/cal.php
(Deskargatu)
<? include("connect.php"); ?>
<div style="margin-left:5px;background-color:white;font-family:Verdana, Arial, Helvetica, sans-serif">
<?
if ($_GET['id'])
{
ereg("^([0-9]{4})\/([0-9]{2})",$_GET['id'],$regs);
}
$mois = array(0,31,28,31,30,31,30,31,31,30,31,30,31);
$noms = array(0,
"Janvier",
"Février",
"Mars",
"Avril",
"Mai",
"Juin",
"Juillet",
"Aout",
"Septembre",
"Octobre",
"Novembre",
"Décembre");
$this_month = (empty($regs[2]) ? date(n) : $regs[2]);
$this_year = (empty($regs[2]) ? date(Y) : $regs[1]);
$time = mktime(0,0,0,$this_month,1,$this_year);
$this_month = preg_replace("/0([0-9])/","$1",$this_month);
echo "
<h4 style=\"text-align:center;border-bottom:1px solid orange\">$noms[$this_month] $this_year<h4>
<table style=\"margin:0px;border:1px solid grey\" border=\"1\">
<tr style=\"border:none\">
<th style=\"border:none\">Di</th>
<th style=\"border:none\">Lu</th>
<th style=\"border:none\">Ma</th>
<th style=\"border:none\">Me</th>
<th style=\"border:none\">Je</th>
<th style=\"border:none\">Ve</th>
<th style=\"border:none\">Sa</th>
</tr>
<tr style=\"border:none\">
";
for ($i=0; $i<date(w,$time); $i++)
{
echo "\t<td style=\"border:none\"></td>\n";
}
for ($num="1"; $num<=$mois[$this_month]; $num++)
{
if (($i % 7) == 0) { echo "</tr>\n<tr style=\"border:none\">\n"; }
echo "\t<td style=\"border:none\">";
if ($num<10 and $this_month <10) { $athis_month="0".$this_month; $anum = "0".$num; }
elseif ($num<10) { $anum = "0".$num; $athis_mont = $this_month; }
else{ $anum = $num; $athis_mont = $this_month; }
$query = "SELECT * FROM blog WHERE date like '".$this_year.$athis_month.$anum."%' LIMIT 1";
$result = mysql_query($query);
if (mysql_num_rows($result) != 0)
{
echo "<a style=\"color:orange\" href=\"blog.php?id=".$this_year."/".$athis_month."/".$anum."\">$num</a>";
}
else { echo "$num"; }
echo "</td>";
$i++;
}
echo "</tr>
</table>";
if ($this_year < 2005) {
echo "<h4 style=\"text-align:center;border-bottom:1px solid orange\"> $this_year <a href=\"blog.php?id=".($this_year+1)."/01\">»</a><h4>";
}
else
{ echo "<h4 style=\"text-align:center;border-bottom:1px solid orange\"><a href=\"blog.php?id=".($this_year-1)."/12\">«</a> $this_year <a href=\"blog.php?id=".($this_year+1)."/01\">»</a><h4>"; }
echo "<div style=\"margin-left:5px;background-color:white;font-family:Verdana, Arial, Helvetica, sans-serif\">";
for ($i=1;$i<7;$i++)
{
echo "<a style=\"font-weight:normal\" href=\"blog.php?id=$this_year/0$i\">0$i</a> ";
}
echo "<br>";
for ($i=6;$i<13;$i++)
{
if ($i<10) { echo "<a style=\"font-weight:normal\" href=\"blog.php?id=$this_year/0$i\">0$i</a> "; }
else { echo "<a style=\"font-weight:normal\" href=\"blog.php?id=$this_year/$i\">$i</a> "; }
}
$query = "SELECT distinct(section) FROM blog ORDER BY section";
$result = mysql_query($query) or die(mysql_error());
echo "<h4 style=\"text-align:center;border-bottom:1px solid orange\">Catégories<h4><ul style=\"list-style:square inside; padding:0px;\">";
while($row = mysql_fetch_assoc($result))
{
echo "<li><a style=\"font-weight:normal\" href=\"blog.php?id=".$row['section']."\">".$row['section']."</a></li>\n";
}
echo "</ul>";
?>
</div>
</div>