Location: PHPKode > projects > vasp (Virtual Agenda System Project) > vasp 0.01/htdocs/agenda.php
<?php
session_save_path('/home/groups/v/va/vasp/sessions');
session_start(); 
header("Cache-control: private"); 
if ($_SESSION['userid']=='') {exit('Unauthorized entry, scripts ceased');}
?>
<!-- Name Grade/Block -->

<HTML>
<HEAD>
<TITLE>vasp Agenda Page</TITLE>
<link href="vaspstyle.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY leftmargin="0" topmargin="0" rightmargin="0" bottommargin"0">
<div id="fullpage" align="CENTER">
<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=123193&amp;type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" align="left"/></a>
<div id="enclosing" align="LEFT">
<div id="header" align="LEFT">
<IMG SRC="images/banner.gif" WIDTH="200" HEIGHT="40" ALT="" BORDER="0">
</div>
<hr size="2">
<div id="navbar" align="LEFT">
<img src="images/agenda.gif">
<img src="images/classgroups.gif">
<img src="images/messenger.gif">
</div>
<div id="main">
<hr size="2">
<br>
<?php
include 'config.php';
$date = getdate();
$month = $_POST['month'];
$day = $_POST['day'];
$dates = $_POST['dates'];
$edit = $_POST['edit'];
	if (empty($month)) {
		$month = $date['month'];
		if (empty($day)) {
			$yday = $date['yday'];
			$day = $date['mday'];
		}}
else {
	$timestamp = mktime(0,0,0,$month,$day,0);
	$date = getdate($timestamp);
	$yday = $date['yday'];
	$month = $date['month'];
	}

echo "Selected date is the $day of $month <p>";

$dbcon = mysql_connect("$mysqlserver","$mysqluser","$mysqlpass");
if (!$dbcon) {
	echo ('Unable to connect to MySQL server');
	exit();
}
mysql_select_db("$mysqldb");

$todayent = mysql_query("SELECT yday FROM agenda WHERE yday = \"$yday\"");
$row = mysql_fetch_array($todayent);
if ($dates == '1') {
echo 'Please choose a date for viewing:';
echo "<form action=\"agenda.php\" method=\"post\">Enter month (1-12):<INPUT type=\"text\" name=\"month\"></br>Enter day:<INPUT type=\"text\" name=\"day\"> <INPUT type=\"submit\"></form>";
}
else {
if ($edit == '1') {
$resID = mysql_query("SELECT ID FROM agenda WHERE yday = \"$yday\"");
$ID = mysql_fetch_array($resID);
$ID = $ID['ID'];
echo 'Please insert the new attributes:';
echo '<form action="agenda/edit.php" method="post"> Message Header: <INPUT type="text" name="head"><br>Message:<br><TEXTAREA name="mess" rows="15" cols="40">Your agenda entry will be placed here.</TEXTAREA><br>Reminder?<INPUT type="radio" name="remind" value="1">Yes<INPUT type="radio" name="remind" value="0">No<p><INPUT type="hidden" name="ID" value="'."$ID".'"><INPUT type="submit" value="Add to agenda"></form>';
}
else {
if ($row['yday'] != $yday) {
echo 'No entry is present for today, Create one below:<p><hr><br>';
echo '<h4>NOTE:</h4> No PHP tags allowed! Only the following HTML tags are allowed:&lt;p&gt; &lt;b&gt; &lt;pre&gt; &lt;h1&gt; &lt;br&gt;<br>';
echo   '<h4>New Entry:</h4><form action="agenda/addentry.php" method="post"> Message Header: <INPUT type="text" name="head"><br>Message:<br><TEXTAREA name="mess" rows="15" cols="40">Your agenda entry will be placed here.</TEXTAREA><br>Reminder?<INPUT type="radio" name="remind" value="1">Yes<INPUT type="radio" name="remind" value="0">No<p><INPUT type="hidden" name="yday" value="'."$yday".'"><INPUT type="submit" value="Add to agenda"></form>';		
}
else {
$toolvis = '1';
echo 'There is a entry present for today:';
$resmessage = mysql_query("SELECT message FROM agenda WHERE yday = \"$yday\"");
$resheader = mysql_query("SELECT header FROM agenda WHERE yday = \"$yday\"");
$resID = mysql_query("SELECT ID FROM agenda WHERE yday = \"$yday\"");
$message = mysql_fetch_array($resmessage);
$header = mysql_fetch_array($resheader);
$ID = mysql_fetch_array($resID);
$message = $message['message'];
$header = $header['header'];
$ID = $ID['ID'];
echo "$header <p> $message";
}}}
?>
</div>
<div id="toolbar">
<?php
if ($toolvis == '1'){
echo "<form action=\"agenda/delete.php\" method=\"post\"><INPUT type=\"hidden\" name=\"ID\" value=\"$ID\"><INPUT type=\"image\" src=\"images/delete.gif\"></form>";
echo "<form action=\"agenda.php\" method=\"post\"><INPUT type=\"hidden\" name=\"edit\"
value=\"1\"><INPUT type=\"image\" src=\"images/edit.gif\"></form>";
}
echo "<form action=\"agenda.php\" method=\"post\"><INPUT type=\"hidden\" name=\"dates\" value=\"1\"><INPUT type=\"image\" src=\"images/dates.gif\"></form>";
?>
</div>
</div>
</BODY>
</HTML>












Return current item: vasp (Virtual Agenda System Project)