Location: PHPKode > projects > MyPHPSchool > MyPHPSchool-0.3.1/html/calendar/display.php
<?
	include ("../main.inc.php");
	list($ulvl, $loggedin) = check_auth();

print_header("MHS:Calendar:$day/$month/$year");
			$mysql_tablename = 'calendar';
	$monthname = date('F', mktime(0,0,0,$month,1,$year));

	echo "<font face=Arial size=5><b><center>$day $monthname $year</b><p>";
	$lastseconds = mktime(0,0,0,$month,$day,$year)-(24*60*60);
        $lastday = date('j', $lastseconds);
        $lastmonth = date('m', $lastseconds);
        $lastyear = date('Y', $lastseconds);

        $nextseconds = mktime(0,0,0,$month,$day,$year)+(24*60*60);
        $nextday = date('j', $nextseconds);
        $nextmonth = date('m', $nextseconds);
        $nextyear = date('Y', $nextseconds);

	echo "<center><table><tr>";
        echo "<td><form method=post action=display.php><input type=submit value='<<'>
        <input type=hidden name=day value=$lastday>
        <input type=hidden name=month value=$lastmonth>
        <input type=hidden name=year value=$lastyear></form></td>";
	
	if($ulvl > 30  && $loggedin){
	echo " 
              <td><form method=post action=operate.php>
                <input type=hidden name=month value=$month>
                <input type=hidden name=year value=$year>
                <input type=hidden name=day value=$day>
                <input type=submit name='action' value='Add item to calendar'>
              </form></td>

              <td><form method=post action=modify.php>
                <input type=hidden name=month value=$month>
                <input type=hidden name=day value=$day>
                <input type=hidden name=year value=$year>
                <input type=submit value='Delete or Modify'>
              </form></td>";
	}
		echo "
              <td><form method=post action=welcome.php>
              <input type=submit value='Return to Calendar'>
              <input type=hidden name=day value=$day>
              <input type=hidden name=month value=$month>
              <input type=hidden name=year value=$year>
              </form>
              </td> ";

        echo "<td><form method=post action=display.php><input type=submit value='>>'>
        <input type=hidden name=day value=$nextday>
        <input type=hidden name=month value=$nextmonth>
        <input type=hidden name=year value=$nextyear></form></td></tr></table>";

	$query = mysql_query("SELECT * FROM $mysql_tablename WHERE stamp >= \"$year-$month-$day 00:00:00\" AND stamp <= \"$year-$month-$day 23:59:59\" ORDER BY stamp", $db);

	while ($row = mysql_fetch_array($query))
	{
		echo "	<table cellpadding=5 cellspacing=5 border=1>
			<tr><td><b>Time</td><td><b>Event</td></tr>
			<td>$row[stamp]</td>
			<td>$row[subject]</td></tr>
			<tr><td colspan=3>$row[description]</td></tr></table><p><hr width=50%><p>";
	}
	
	echo "<center><table><tr>";
	echo "<td><form method=post action=display.php><input type=submit value='<<'>
	<input type=hidden name=day value=$lastday>
	<input type=hidden name=month value=$lastmonth>
	<input type=hidden name=year value=$lastyear></form></td>"; 
	
	if($ulvl > 30  && $loggedin){
	echo "
	      <td><form method=post action=operate.php>
		<input type=hidden name=month value=$month>
		<input type=hidden name=year value=$year>
		<input type=hidden name=day value=$day>
		<input type=submit name='action' value='Add item to calendar'>
	      </form></td>

	      <td><form method=post action=modify.php>
	        <input type=hidden name=month value=$month>
		<input type=hidden name=day value=$day>
		<input type=hidden name=year value=$year>
		<input type=submit value='Delete or Modify'>
	      </form></td>";
	}
		echo "
	      <td><form method=post action=welcome.php>
	      <input type=submit value='Return to Calendar'>
	      <input type=hidden name=day value=$day>
	      <input type=hidden name=month value=$month>
	      <input type=hidden name=year value=$year>
	      </form>
	      </td> ";
	echo "<td><form method=post action=display.php><input type=submit value='>>'>
	<input type=hidden name=day value=$nextday>
	<input type=hidden name=month value=$nextmonth>
	<input type=hidden name=year value=$nextyear></form></td></tr></table>";

?>
Return current item: MyPHPSchool