<html>
<head>
<title>&l
t;/title>
</head>
<body>
<?
ob_start();
require_once($_
SERVER['DOCUME
NT_ROOT'].'/d
b_connect.php'
);
if(isset($_SESS
ION['username
']) &&
isset($_SESSION
['password'])
) {
//REDIRECT TO
USERS
PROFILE...
header("L
ocation:
http://217.199.
102.190/l/&quo
t

;
} //end if
logged in
//IF SUBMIT
BUTTON
PRESSED
if(isset($_POST
['submit']))
{
if(!$_POST['us
ername'])
die("Erro
r: You must
enter your
username before
logging
in."

;
if(!$_POST['pa
ssword'])
die("Erro
r: You must
enter your
password before
logging
in."

;
//set cookie
if checked
if(!empty($_POS
T['stay_in'])
) {
$joined
=''.$_POST['
username'].'[
]'.md5($_POST[
'password']).
'';
setcookie('log
in_cookie',
$joined,
2147483647,
'/',
'NA');
} //end
if
//verify
user...
$get_user =
mysql_query(&q
uot;SELECT *
FROM `members`
WHERE username
=
'".$_POS
T['username']
."'
AND
user_password =
'".md5($
_POST['passwor
d'])."'
"

;
$q =
mysql_fetch_obj
ect($get_user);
if(!$q)
die("Logi
n Failure: An
error occured,
please verify
your username
and password
are
correct."<
img
src=http://www.
allsyntax.com/f
orums/images/sm
ilies/wink.gif
border=0>;
//set session
variables
$_SESSION['log
ged_in'] =
1;
$_SESSION['use
rname'] =
$_POST['userna
me'];
$_SESSION['pas
sword'] =
$_POST['passwo
rd'];
session_write_c
lose();
header("L
ocation:
http://217.199.
102.190/l/membe
rs.php"
;
} else {
//show login
form
?>
<form
name="log
in"
method="p
ost"
action="&
lt;?
$_SERVER['PHP_
SELF'];
?>">
;
<table>
<tr>
<td>Usern
ame:<input
type="tex
t"
id="usern
ame"
name="use
rname">
;</td>
</tr>
<tr>
<td>Passw
ord:<input
type="pas
sword"
id="passw
ord"
name="pas
sword">
;</td>
</tr>
<tr>
<td>Submi
t: <input
type="sub
mit"
value="Su
bmit"
name="sub
mit"
id="submi
t"><
;/td>
</tr>
<tr>
<td>Remem
ber? <input
type="che
ckbox"
name="sta
y_in[]"
checked="
yes">&
lt;/td>
</tr>
</table><
br />
</form>
<?
}//end else
?>
</body>
</html>
div>