Location: PHPKode > scripts > Simple Event calendar > simple-event-calendar/admin/mainpage.php
<?php
	session_start();
	include("../lib/config.php");
	include("../lib/functions.php");
	$obj = new eventcal();
	if(!$_SESSION['admin'] == ADMIN)
	{
		header("location:login.php");
	}
	if(isset($_POST['addevent']))
	{
		$date = $_POST['day'].":".$_POST['mnth'].":".$_POST['year'];
		$eventitle = $_POST['eventtitle'];
		if($eventitle !='')
		{
				$desc = $_POST['desc'];
				if($desc == '')
				{
					$desc = "No description";
				}
				$cont = $date ."-"."\r\n";
				$cont = $cont.$eventitle."-"."\r\n";
				$cont = $cont.$desc."\r\n"."/";
				$dbfile = ROOT."/".DBFILE;
				$handle = fopen($dbfile,"a+");
				fwrite($handle,$cont);
				fclose($handle);
		}
	}
	$obj->include_head();
?>
	<form action="" method="post" name="frm">
		<table align="center" width="450" border="0">
				<tr><th colspan="2">Add Event</th></tr>
				<tr><td>Date</td><td>
							<select name="day">
							<?php
								for($i=1; $i < 32 ; $i++)
								{
									echo "<option value='".$i."'>".$i."</option>";
								}
							?>
							</select>
							<select name="mnth">
							<?php
								for($i=1; $i < 13 ; $i++)
								{
									echo "<option value='".$i."'>".$i."</option>";
								}
							?>
							</select>
						<select name="year">
							<?php
								for($i=2007; $i < 2011 ; $i++)
								{
									echo "<option value='".$i."'>".$i."</option>";
								}
							?>
							</select>
				</td></tr>
				<tr><td>Event Title</td><td><input type="text" name="eventtitle"></td></tr>
				<tr><td>Event Description</td><td><textarea name="desc" cols="30" rows="10"></textarea></td></tr>
				<tr><th colspan="2"><input type="submit" name="addevent" value="Add Event" onClick="return valform();"></th></tr>
		</table>
	</form>
<?php
		$obj->footer();
?>

Return current item: Simple Event calendar