01.
<?php
02.
include
'connect.php'
;
03.
@session_start();
04.
if
(!
empty
(
$_POST
[
'submit'
])) {
05.
header(
"Location:login.html"
);
06.
exit
();
07.
}
08.
$test_query
=
"SELECT * FROM login WHERE username = '"
.
$_POST
['form-username
']."'
";
09.
$query_result
=mysql_query(
$test_query
)
or
die
(
$query
.
' '
. mysql_error());
10.
if
(mysql_num_rows(
$query_result
)==0) {
11.
echo
"The username you entered is invalid."
;
12.
}
else
{
13.
while
(
$row_query
= mysql_fetch_array(
$query_result
)){
14.
if
(
$row_query
[
'password'
]==
$_POST
[
'form-password'
]) {
15.
$_SESSION
[
'password'
] =
$_POST
[
'form-password'
];
16.
header(
"Location:Home.php"
);
17.
exit
();
18.
}
else
{
19.
echo
"Password is not correct."
;
20.
}
21.
}
22.
}
23.
?>