Location: PHPKode > scripts > The First Year Script > the-first-year-script/firstyearform.php
<?
$LOGIN = "admin";
$PASSWORD = "baby";

function error ($error_message)
	{
		echo $error_message."<BR>";
		exit;
	}

if ( (!isset($PHP_AUTH_USER)) || ! (($PHP_AUTH_USER == $LOGIN) && ( $PHP_AUTH_PW == "$PASSWORD" )) )
	{
		header("WWW-Authenticate: Basic entrer=\"Form2txt admin\"");
		header("HTTP/1.0 401 Unauthorized");
		error("Unauthorized access...");
	}
?>

<html>
	<head>
		<title>the first year script: customize the script!</title>
		<style type="text/css">
			td { font-family : Verdana,Geneva,Arial,sans-serif; font-size : 10px; }
			.box1 { background-color : #ffffff; border : 1px solid #000000; }
			.box3 { background-color : #ffffff; border : 1px solid #000000;  }
		</style>
		<script language="javascript">
		function popup()
			{ window.open ("suggestions.html","popup","width=175,height=300,location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=1,toolbar=0") }
		</script>
	</head>
	<body bgcolor="#ffffff" text="#000000" link="#000000" vlink="#000000" alink="#000000" bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0" marginwidth="0" marginheight="0">
		<center>
			<table border="0" cellpadding="5" cellspacing="0">
				<tr valign="top">
					<td>
						<table border="0" cellpadding="2" cellspacing="1">
							<tr valign="top">
								<td class="box1">
									<table border="0" cellpadding="2" cellspacing="1">
										<tr valign="top">
											<td class="box2">
												<center>
												<table>
													<tr>
														<td>
															<?php require("firstyear.php"); ?>
														</td>
													</tr>
												</table>
												</center>
												<br><hr><br>
												<table>
													<tr>
														<td colspan="3">
															Use this form to customize the script for your baby.  You'll only need to fill this part out the first time.
														</td>
													</tr>
													<tr>
														<td colspan="3">
															<form method="post" action="<?php echo $PHP_SELF ?>">
														</td>
													</tr>
													<tr>
														<td>
															Baby's Name:
														</td>
														<td>
															<input type="text" name="name" size="45">
														</td>
														<td>
														</td>
													</tr>
													<tr>
														<td>
															Baby's Birthday:
														</td>
														<td>
															<select name="month">
															<option value="January">January</option>
															<option value="February">February</option>
															<option value="March">March</option>
															<option value="April">April</option>
															<option value="May">May</option>
															<option value="June">June</option>
															<option value="July">July</option>
															<option value="August">August</option>
															<option value="September">September</option>
															<option value="October">October</option>
															<option value="November">November</option>
															<option value="December">December</option>
															</select>
															<select name="day">
															<option value="01">01</option>
															<option value="02">02</option>
															<option value="03">03</option>
															<option value="04">04</option>
															<option value="05">05</option>
															<option value="06">06</option>
															<option value="07">07</option>
															<option value="08">08</option>
															<option value="09">09</option>
															<option value="10">10</option>
															<option value="11">11</option>
															<option value="12">12</option>
															<option value="13">13</option>
															<option value="14">14</option>
															<option value="15">15</option>
															<option value="16">16</option>
															<option value="17">17</option>
															<option value="18">18</option>
															<option value="19">19</option>
															<option value="20">20</option>
															<option value="21">21</option>
															<option value="22">22</option>
															<option value="23">23</option>
															<option value="24">24</option>
															<option value="25">25</option>
															<option value="26">26</option>
															<option value="27">27</option>
															<option value="28">28</option>
															<option value="29">29</option>
															<option value="30">30</option>
															<option value="31">31</option>
															</select>
															<select name="year">
															<option value="1990">1990</option>
															<option value="1991">1991</option>
															<option value="1992">1992</option>
															<option value="1993">1993</option>
															<option value="1994">1994</option>
															<option value="1995">1995</option>
															<option value="1996">1996</option>
															<option value="1997">1997</option>
															<option value="1998">1998</option>
															<option value="1999">1999</option>
															<option value="2000">2000</option>
															<option value="2001">2001</option>
															<option value="2002">2002</option>
															<option value="2003">2003</option>
															<option value="2004">2004</option>
															<option value="2005">2005</option>
															<option value="2006">2006</option>
															<option value="2007">2007</option>
															<option value="2008">2008</option>
															<option value="2009">2009</option>
															<option value="2010">2010</option>
															</select>
														</td>
														<td>
														</td>
													</tr>
													<tr>
														<td>
															Baby's Gender:
														</td>
														<td>
															<select name="gender">
															<option value="boy">boy</option>
															<option value="girl">girl</option>
															<option value="twins">twins</option>
															</select>
														</td>
														<td>
														</td>
													</tr>
													<tr>
														<td>
														</td>
														<td>
															<input type="submit" name="customize" value="submit">
														</td>
														<td>
														</td>
													</tr>
													<tr>
														<td colspan="3">
															</form>
														</td>
													</tr>
													<tr>
														<td colspan="3">
															<br><hr><br>
														</td>
													</tr>
													<tr>
														<td colspan="3">
															Use this form to update your current picture.  Just put in the link to the most recent picture you've taken.
														</td>
													</tr>
													<tr>
														<td colspan="3">
															<form method="post" action="<?php echo $PHP_SELF ?>">
														</td>
													</tr>
													<tr>
														<td>
															Picture URL:
														</td>
														<td>
															<input type="text" name="pic" size="45">
														</td>
														<td>
														</td>
													</tr>
													<tr>
														<td>
															Thumbnail URL:
														</td>
														<td>
															<input type="text" name="tn" size="45">
														</td>
														<td>
															(100x75 or 75x100 pixels)
														</td>
													</tr>
													<tr>
														<td>
															Picture Date:
														</td>
														<td>
															<input type="text" name="picdate" size="45">
														</td>
														<td>
														</td>
													</tr>
													<tr>
														<td>
														</td>
														<td>
															<input type="submit" name="pictures" value="submit">
														</td>
														<td>
														</td>
													</tr>
													<tr>
														<td colspan="3">
															</form>
														</td>
													</tr>
													<tr>
														<td colspan="3">
															<br><hr><br>
														</td>
													</tr>
													<tr>
														<td colspan="3">
															Use this form to update your milestone.  Don't forget!  New milestones overwrite the old ones.
														</td>
													</tr>
													<tr>
														<td colspan="3">
															<form method="post" action="<?php echo $PHP_SELF ?>">
														</td>
													</tr>
													<tr>
														<td>
															Milestone:
														</td>
														<td>
															<input type="text" name="mile" size="45">
														</td>
														<td>
															(<a href="javascript:popup()">suggestions</a>)
														</td>
													</tr>
													<tr>
														<td>
															Milestone Date:
														</td>
														<td>
															<input type="text" name="miledate" size="45">
														</td>
														<td>
														</td>
													</tr>
													<tr>
														<td>
														</td>
														<td>
															<input type="submit" name="milestones" value="submit">
														</td>
														<td>
														</td>
													</tr>
													<tr>
														<td colspan="3">
															</form>
														</td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</center>
		<?php
			if($customize)
    				{
					@extract($_POST);
					if(is_writable('customize.csv'))
					{
					$fp = fopen('customize.csv','a');
					$content = "$name,$month,$day,$year,$gender,\n";
					fwrite($fp,$content);
					fclose($fp);
					print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"0; URL=firstyearform.php\">";
					}
					else
					{
					echo'File is not writable';
					}
				}
			elseif($pictures)
    				{
					@extract($_POST);
					if(is_writable('pictures.csv'))
					{
					$fp = fopen('pictures.csv','a');
					$content = "$pic,$tn,$picdate,\n";
					fwrite($fp,$content);
					fclose($fp);
					print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"0; URL=firstyearform.php\">";
					}
					else
					{
					echo'File is not writable';
					}
				}
			elseif($milestones)
    				{
					@extract($_POST);
					if(is_writable('milestones.csv'))
					{
					$fp = fopen('milestones.csv','a');
					$content = "$mile,$miledate,\n";
					fwrite($fp,$content);
					fclose($fp);
					print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"0; URL=firstyearform.php\">";
					}
					else
					{
					echo'File is not writable';
					}
				}
			else
    				{}
		?>
	</body>
</html>
Return current item: The First Year Script