Location: PHPKode > projects > PHP Trivia > php-trivia/index.php
<?php
// ***************************************************************************
// *
// * PHP Dynamic Trivia -- Add your own trivia file.
// * Copyright (C) 2005  Robin van de Vusse (hide@address.com)
// * 
// * This program is free software; you can redistribute it and/or
// * modify it under the terms of the GNU General Public License
// * as published by the Free Software Foundation; either version 2
// * of the License, or (at your option) any later version.
// * 
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// * GNU General Public License for more details.
// * 
// * You should have received a copy of the GNU General Public License
// * along with this program; if not, write to the Free Software
// * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// *
// ***************************************************************************
require_once "config.php";

if (strlen(trim($strSessionPath)) > 0)
	session_save_path($strSessionPath);

session_start();

$strMessage = "";

if (!empty($_SESSION['message']))
{
	$strMessage = trim($_SESSION['message']);
}
?>

<html>
<head>
<title>Login</title>
</head>
<body>

<center><img src="images/trivia.jpg"></center><br><hr>

<form name="login" action='login.php' method='POST'>
<table width='800'>
	<tr>
		<td width='160' valign='top' align='center' STYLE='background-color: #9999cc;'>
			<table>
				<tr><td STYLE='background-color: #ccccff; color: #000000;'><a href="options.php" accesskey='c'>[<span STYLE="color: red">C</span>reate a character]</a></td></tr>
			</table>
		</td>
		<td width='640' align='center'>
			<?php
			if (strlen(trim($strMessage)) > 0)
			{
				echo $strMessage;
				$_SESSION['message'] = "";	
			}
			?>
			<table>
				<tr><td><u>U</u>sername:</td></tr>
				<tr><td><input type='text area' name='name' accesskey='u' size='10'></td></tr>
				<tr><td><u>P</u>assword:</td></tr>
				<tr><td><input type='password' name='password' accesskey='p' size='10'></td></tr>
				<tr><td><input type='submit' name='submit' value='Log in' class='button'></td></tr>
			</table>
		</td>
	</tr>
</table>
</form>

<?php require_once "footer.php"; ?>
</body>
</html>

<script type="text/javascript">
<!--
document.login.name.focus();
document.onkeypress=keyevent;

function keyevent(e)
{
	var c;
	
	c=String.fromCharCode(window.event.keyCode).toUpperCase(); 	
	target=window.event.srcElement;
	
	if (target.nodeName.toUpperCase() == 'INPUT')
	{
		if (target.type.toUpperCase() == 'SUBMIT')
		{
			if (c == 'C') { window.location='options.php';; return false; }
		}
	}
	else
	{
		if (c == 'C') { window.location='options.php';; return false; }
	}
}
//-->
</script>
Return current item: PHP Trivia