Location: PHPKode > projects > WaveWatcher > wavewatcher3/html/index.php
<?
	/****************************************************************************
	 * Name:		login.php
	 * Desc:		Loginpage for WaveWatcher
   ***************************************************************************/
	require_once("../classes/user.php");

	// This is extremly important!!!
	session_start();

	// For error handling
	$err = false;

	// Create a user object
	$user = new User();

	// Check if we are loggedin... and if, redirect to home.php
	if ($user->IsLoggedIn())
		header("Location: home.php");

	// verify user
	if ($HTTP_POST_VARS)
	{
		// Get FORM values
		$username = $HTTP_POST_VARS["username"];
		$password = $HTTP_POST_VARS["password"];

		if (!empty($username) && !empty($password))
		{
			// Check if it's a valid user
			if ($user->Login($username, $password))
				header("Location: home.php");
			else
				$err = true;
		}
	}
?> 

<html>
	<head>
		<title>Wavewatcher Login</title>
		<link href="css/style1.css" rel="styleSheet" type="text/css">
	</head>

	<body bgcolor="#ffffff">

	<form method="post">
	
	<table width = "50%" height="80%" align="center" border="0">
		<tr>
			<td>

				<!-- background table -->
				<table width="300" align="center" border="0" cellspacing="1" cellpadding="0" bgcolor="#000000">
					<tr>
						<td>
							<!-- gui table -->
							<table width="300" border="0" cellspacing="1" cellpadding="2">
								
				<!-- title row -->
	<tr>
	<td bgcolor="#515173">
	<font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF"><b>Wavewatcher login...</b></font>
									</td>
								</tr>
								
								<!-- message row -->
								<? 
								if ($err)
								{ 
								?>

								<tr>
									<td bgcolor="#FC4848">
										<font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">
											Invalid username and/or password! In order to use this utility, you must be registered.
										</font>
									</td>
								</tr>

								<?	
								}
								else
								{
								?>
								
								<tr>
									<td bgcolor="#c0c0c0">
										<font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">
											In order to use this utility, you must be registered.
										</font>
									</td>
								</tr>
								<?
								}
								?>

								<!-- username and password row -->
								<tr bgcolor="#fcfcfc">
									<td>
										<table width="100%" border="0" cellspacing="0" cellpadding="2">
											<tr>
												<td width="120" align="right">
													<font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">Username: </font>
												</td>
												<td width="180">
													<input name="username" type="text" size="25">
												</td>
											</tr>
											<tr>
												<td width="120" align="right">
													<font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#000000">Password: </font>
												</td>
												<td width="180">
													<input name="password" type="Password" size="25">
												</td>
											</tr>
										</table>
									</td>
								</tr>

								<!-- Submit -->
								<tr bgcolor="#fcfcfc">
									<td align="center">
										<input name="login" type="submit" value="Login">
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	</form>
	</body>
<html>
Return current item: WaveWatcher