Location: PHPKode > projects > XMasDB > xmasdb/index.php
//Include Config file for Username and Password
include 'config.php';
// start the session
$errorMessage = '';
if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) {
// check if the user id and password combination is correct
if ($_POST['txtUserId'] === $username && $_POST['txtPassword'] === $password) {
// the user id and password match, 
// set the session
$_SESSION['basic_is_logged_in'] = true;

// after login we move to the main page
header('Location: list.php');
} else {
$errorMessage = 'Sorry, wrong user id / password';

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>X-Mas Gift Database</title>
<style type="text/css">@import url("style.css");</style>
<center><h2>X-Mas Gift Database</h2></center>

$filename = 'lib/installdb.php';

if (file_exists($filename)) {
    echo "<P><b>Warning!</b> The file '/$filename' exists, please delete it ASAP!<P><br>";

if ($errorMessage != '') {
<p align="center"><strong><font color="white"><?php echo $errorMessage; ?></font></strong></p>
<form method="post" name="frmLogin" id="frmLogin" action="">
<table width="300" border="1" align="center" cellpadding="2" cellspacing="0">
<td width="150">User Id</td>
<td><input name="txtUserId" type="text" id="txtUserId"></td>
<td width="150">Password</td>
<td><input name="txtPassword" type="password" id="txtPassword"></td>
<input type="submit" class="btn" name="btnLogin" value="Login">

Return current item: XMasDB