PDA

View Full Version : Login session help [+rep]



Javascrypt
30-05-2009, 08:48 PM
Okay, so i have made a login session for my site and it registers a session called username. When you login you go to a client area. but what i need help with is that when you click home it takes you back to the home but i need the php to get the users name in the top right of the navigation. i can do the css and html for it but i cant do the html. help.

(clearer: I want it to check for the registered session,if it is found i want it to echo something. if it isnt found then i want it to echo something )

Help me please.

Johno
30-05-2009, 09:04 PM
Well it would be something just like:



<?PHP
if ($_SESSION['username']) {
$username = $_SESSION['username'];

echo $username;
} else {

echo 'Not logged in';
}
?>


I reckon that would work, I would do it a bit better but sitting in a tent with a friend! :)

Javascrypt
31-05-2009, 10:38 AM
Well it would be something just like:



<?PHP
if ($_SESSION['username']) {
$username = $_SESSION['username'];

echo $username;
} else {

echo 'Not logged in';
}
?>
I reckon that would work, I would do it a bit better but sitting in a tent with a friend! :)

It wont work, when i log in it still says not logged in. I have sent you a pm, please read it.

Johno
31-05-2009, 10:54 AM
I haven't gotten a PM, sure you sent it to me?

EDIT: Ok, I received it now.

Want to hide these adverts? Register an account for free!