Location: PHPKode > projects > phpautotest > login.php
<?php
session_start();

require 'includes/phpautotest_config.php';
require 'includes/phpautotest_functions.php';

// We use $flag as we want to display the error after including the HTML of the header, menu, etc
$flag = 0;

if(isset($_GET['password']))
{
	if($_GET['password'] == $phpautotest_password)
	{
		//$_SESSION['logged_in'] = 1;

		setcookie('logged_in', 1);
		
		header('Location: index.php');
	}
	else
	{
		$flag = 1;
	}
}

// We put this after the form processing to avoid sending headers before calling header()
require 'includes/header.php';
require 'includes/top_menu.php';

if($flag == 1)
{
	phpautotest_show_message($phpautotest_message['login_failure']);
}

echo
"
<form method = 'GET' action = '$PHP_SELF'>
<table cellspacing='1' cellpadding='3' bgcolor='white' align = 'center' class = 'box'> 

<tr bgcolor='#005896'>
	<td colspan = '2'><font color='#FFFFFF'><b>Authentication required</b></font></td>
</tr>

<tr bgcolor = '#dddddd'>
	<td>Password</td>
	<td><input type = 'password' name = 'password' class = 'phpautotest_text'></td>
</tr>

<tr bgcolor = '#dddddd'>
	<td colspan = '2' align = 'right'><input type = 'submit' value = 'start' class = 'phpautotest_button'></td>
</tr>

</table>
</form>
";

require 'includes/footer.php';
?>
Return current item: phpautotest