Hi,
There are two ways of doing this... one is by creating a DB n stuff like that.. the other one is something like this:
(index.html)
CODE
<?php
session_start();
$errorMessage = '';
if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) {
if ($_POST['txtUserId'] === 'user' && $_POST['txtPassword'] === 'passwd123') {
$_SESSION['basic_is_logged_in'] = true;
header('Location: yourlocation.php');
exit;
} else {
$errorMessage = 'Sorry, wrong user id / password';
}
}
Insert it on your index page above the <html> tag
below this include your form :
CODE
<form method="post" name="frmLogin" id="frmLogin" action="index.php">
<table width="400" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="150">User Id</td>
<td><input name="txtUserId" type="text" id="txtUserId"></td>
</tr>
<tr>
<td width="150">Password</td>
<td><input name="txtPassword" type="password" id="txtPassword"></td>
</tr>
<tr>
<td width="150"> </td>
<td><input type="submit" name="btnLogin" value="Login"></td>
</tr>
</table>
</form>
The username here is 'user' and the password is 'passwd123' .
Please note that this is a very basic user authentication which does not use databases and stuff...It makes use of POST variables and Session variables.