<%@ Page language="c#" AutoEventWireup="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript (ECMAScript)">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<link href="style.css" rel="stylesheet" type="text/css">
		<script language="C#" runat="server">
		public void DoLogin(object sender, System.EventArgs e)
		{
			if (frmUserName.Text == "admin")
			{
				if (frmPassword.Text == "password")
				{
					Session["UserName"] = frmUserName.Text;
					Session["admin"] = "yes";
					Response.Redirect("Topics.aspx");
				}
				else
				{
					frmPassword.Visible = true;
				}
			}
			else
			{
				Session["UserName"] = frmUserName.Text;
				Response.Redirect("Topics.aspx");
			}
		}
		</script>
		<script Language="JavaScript">
			function Validate(theForm)
			{
			if (theForm.frmUserName.value == "")
   			{
			      alert("Please enter a username");
			      theForm.frmUserName.focus();
			      return (false);
			   }
			return (true)
			}
		</script>
	</HEAD>
	<body onload="Javascript: document.form1.frmUserName.focus()">
		<form id="form1" method="post" runat="server" onSubmit="return Validate(this)">
			<p>
			</p>
			<p>
			</p>
			<table border="0" align="center" cellspacing="1" cellpadding="5" bgcolor="purple">
				<tr>
					<td width="100%" class="TableItem">
						<b>Enter the Forum:</b>
						<table border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td valign="top">
									Name:
									<asp:TextBox id="frmUserName" runat="server" Columns="15"></asp:TextBox>
								</td>
								<td valign="top" rowspan="2">
									<asp:Button id="Button1" runat="server" OnClick="DoLogin" Text="Go" CssClass="button"></asp:Button>
								</td>
							</tr>
							<tr>
								<td valign="top" align="right">
									<asp:TextBox id="frmPassword" Visible="False" runat="server" Columns="15" TextMode="Password"></asp:TextBox>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</form>
	</body>
</HTML>
