tambien pongo algo del codigo..
Código PHP:
<?php
include("connect.php");
include("functions.php");
echo '<html><head><title>Agenda Calendario Empresrial</title></head>';
echo '<script type="text/javascript">
var des;
function open_win(des)
{
window.open(des,"Event Description","toolbar=yes, location=yes, directories=no, status=no , menubar=yes , scrollbars=yes, resizable=no, copyhistory=yes, width=400 ,height=400")
}
</script> ';
$month = date("n/Y");
if (isset($_GET['month']))
{
@$month = clean($_GET['month']);
$month = preg_replace("#[^0-9/]#", "", $month);
}
//echo "month is $month<br>";
if (empty($month))
die("Please enter a month.");
$k = explode("/",$month);
$link = "SELECT * FROM calendar WHERE month='$month'";
$res = mysql_query($link) or die(mysql_error());
$info = mysql_fetch_assoc($res);
if (!mysql_num_rows($res)) die("There is no records for this month.");
$startday = $info['start_day'];
$days = $info['total_days'] + $startday;
$stuff = "SELECT * FROM events WHERE date LIKE '$k[0]%$k[1]'";
$show = mysql_query($stuff) or die(mysql_error());
$total = mysql_num_rows($show);
$x = $startday;
$spot = $startday;
while ($r = mysql_fetch_assoc($show))
{
$date = $r['date'];
$time = $r['time'];
$name = $r['name'];
$des = $r['des'];
$date = explode("/",$date);
$date = $date[1];
$all[$date] = $date . "-" . $time . "-" . $name . "-" . $des;
}
$prev = $k[0];
$prev--;
$next = $k[0];
$next++;
$l = $k[1];
if ($prev == 0)
{
$prev = 12;
$l = $k[1] - 1;
}
$j = $k[1];
if ($next == 13)
{
$next = 1;
$j = $k[1] + 1;
}
$h = $prev;
switch($h)
{
case '1': $now = 'February'; break;
case '2': $now = 'March'; break;
case '3': $now = 'April'; break;
case '4': $now = 'May'; break;
case '5': $now = 'June'; break;
case '6': $now = 'July'; break;
case '7': $now = 'August'; break;
case '8': $now = 'September'; break;
case '9': $now = 'October'; break;
case '10': $now = 'November'; break;
case '11': $now = 'December'; break;
case '12': $now = 'January'; break;
}
//echo "startday is $startday<br>";
echo '<table width="100%"><tr><td colspan="6"><a href="addevent.php">Ingresar al Panel de ADMINISTRACIÓN</a></td></tr><tr><td><center><a href="calendar.php?month=' . $prev . '/' . $l . '"><<</a> ' . $now . ' - ' . $k[1] . ' <a href="calendar.php?month=' . $next . '/' . $j . '">>></a></center></td></tr><tr><td><center>Total: ' . $total . '</td></tr></table>';
echo '<table width="100%" border="0" bgcolor="DarkGray" border="1">
<tr><td width="14%"><font color="blue">S</font></td><td width="14%"><font color="blue">M</font></td><td width="14%"><font color="blue">T</font></td><td width="14%"><font color="blue">W</font></td><td width="14%"><font color="blue">T</font></td><td width="14%"><font color="blue">F</font></td><td width="14%"><font color="blue">S</font></td></tr>';
for ($x=1;$x<=$days;$x++)
{
echo '<tr>';
$x--;
for ($y=1;$y<=7;$y++)
{
if ($x == 0)
$x = 1;
$x = $x - $startday+1;
if ($x<$startday-$startday+1 || $x >= $days-$startday+1)
echo '<td width="14%" bgcolor="WhiteSmoke"> <br /> <br /> </td>';
elseif (empty($all[$x]))
echo '<td width="14%" bgcolor="WhiteSmoke"><font color="blue">' . ($x) . '<br /> <br /> </font></td>';
else
{
$cur = explode("-",$all[$x]);
//echo '<td valign="top" width="14%" bgcolor="WhiteSmoke"><b><a href="javascript:void(open_win(' . "'date.php?date=$k[0]/$cur[0]/$k[1]'" . '))"><font color="blue">' . $cur[0] . '</font></a></b>' . "<font size='2'> $cur[1]<br />$cur[2]" . '<br /> </font></td>';
echo '<td valign="top" width="14%" bgcolor="WhiteSmoke"><b><a href="date.php?date=' . $k[0] . '/' . $cur[0] . '/' . $k[1] . '" target=_blank><font color="blue">' . $cur[0] . '</font></a></b>' . "<font size='2'> $cur[1]<br />$cur[2]" . '<br /> </font></td>';
}
$x = $x + $startday -1;
$x++;
}
echo '</tr>';
}
echo '</table>';
?>