Hey, I'm having
a little
problem. I
searched these
forums, but
couldn't find
the successful
answer for me.
I need to echo
out the name of
the user. Heres
my code:
header.php
Code:
<?php
ob_start();
session_start(
);
require_once($_
SERVER['DOCUMEN
T_ROOT'].'/db_c
onnect.php');
//check cookie
if
($_SESSION['log
ged_in'] != 1
&&
isset($_COOKIE[
'login_cookie']
)) {
list($user,
$pass) =
explode('[]',
$_COOKIE['login
_cookie']);
$qu =
mysql_query(&qu
ot;SELECT
`user_password`
FROM `members`
WHERE
`username` =
'".addslas
hes($user).&quo
t;'"  ;
if
(mysql_num_rows
($qu) == 1) {
$passw
=
mysql_fetch_obj
ect($qu);
if
($passw->use
r_password ==
$pass) {
$_SESSION['logg
ed_in'] = 1;
$_SESSION['user
name'] = $user;
$_SESSION['pass
word'] = $pass;
}
}
}
if(!isset($_SES
SION['username'
]) &&
!isset($_SESSIO
N['password']))
{
$_SESSION['logg
ed_in'] = 0;
$user =
"Guest&quo
t;;
}
?>
My index:
Code:
<?php
session_start()
;
include('header
.php');
echo
('<table
border="0&
quot;
cellpadding=&qu
ot;0"
cellspacing=&qu
ot;0"
style="bor
der-collapse:
collapse"
bordercolor=&qu
ot;#111111"
;
width="100
%"
id="Head&q
uot;>
<tr>
<td
width="62%
">
<table
border="0&
quot;
cellpadding=&qu
ot;0"
cellspacing=&qu
ot;0"
style="bor
der-collapse:
collapse"
bordercolor=&qu
ot;#111111"
;
width="100
%"
id="AutoNu
mber7">
<tr>
<td
width="58%
">
<a
href="$sit
eurl">
<img
border="0&
quot;
src="image
s/logo.png"
;
width="506
"
height="10
4"><
/a></td&g
t;
<td
width="42%
">$_SES
SION['username'
];</td>
</tr>
</table>'
);
?>
By the Way, I
even tried
$user
Thanks in
advance. Very
Good tutorials
though =D Edited at 08:42:23 pm on 02/18/08
|