Code: Select all
index.php (first page)
<form name="e;form1"e; method="e;post"e; action="e;logcheck.php"e;>
<table width="e;200"e; border="e;0"e;>
<tr>
<td colspan="e;2"e;>Login</td>
</tr>
<tr>
<td width="e;87"e;>Username</td>
<td width="e;103"e;><input name="e;username"e; type="e;text"e; id="e;username"e;></td>
</tr>
<tr>
<td>Password</td>
<td><input name="e;password"e; type="e;text"e; id="e;password"e;></td>
</tr>
<tr>
<td> </td>
<td><input type="e;submit"e; name="e;Submit"e; value="e;Submit"e;></td>
</tr>
</table>
</form>Code: Select all
logcheck.php (second page)
<?php
session_start();
header("e;Cache-control: private"e;);
$_SESSIONї'username'] = $_POSTї'username'];
$_SESSIONї'password'] = $_POSTї'password'];
$db = @mysql_connect('localhost', 'root') or die('could not connect to mysql db, the server return the error:'.mysql_error());
mysql_select_db("e;timelinesys"e;,$db) or die('could not connect to mysql db, the server return the error:'.mysql_error());
$query = "e;select * from user where username='$username' and password='$password'"e;;
$sql = mysql_query($query) or die(mysql_error());
$count = mysql_num_rows($sql);
$row = mysql_fetch_array($sql);
if ($count >= 1)
{
header('Location: add.php');
}
else
{
header('Location: loginfailed.php');
}
?>Code: Select all
add.php (third page)
<?php
session_start();
header("e;Cache-control: private"e;);
$_REQUESTї'username'] = $_SESSIONї'username'];
?>
<html>
<head>
<meta http-equiv="e;Content-Type"e; content="e;text/html; charset=iso-8859-1"e;>
<title>Untitled Document</title>
</head>
<body>
Welcome <? php echo $_SESSIONї'username']; ?>
<br>
</body>
</html>