php-general | 2003022
Date: 02/18/03
- Next message: Rea_David <email protected>: "[PHP] What are the functions to copy a directory structure & then renam e?"
- Previous message: Nenad Djordjevic: "[PHP] Re: safe mode"
- In reply to: Frank Keessen: "[PHP] $_SESSIONS and printing off.."
- Next in thread: Frank Keessen: "Re: [PHP] $_SESSIONS and printing off.."
- Reply: Frank Keessen: "Re: [PHP] $_SESSIONS and printing off.."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Er... well I've seen a lot worse code than that but maybe you could use ...
if (isset($_SESSION['username']) && !empty($_SESSION['username'])) {
echo 'Welcome '.$_SESSION['username'].', you are still logged in.';
}
else {
header... etc etc
}
Rich
> -----Original Message-----
> From: Frank Keessen [mailto:fkeessen <email protected>]
> Sent: 18 February 2003 09:00
> To: php-general <email protected>
> Subject: [PHP] $_SESSIONS and printing off..
>
>
> Hi All,
>
> I'm a little bit confused and it's maybe a newbie question but
> maybe you can help me out;
>
> A user is login in and after username password check it will
> redirects to this page
>
> <?php
> session_start();
> if (isset($_SESSION['username'])){
> $username = $_SESSION['username'];
> echo 'Welcome, you are still loged in.';
> echo $username;
> }
> else{
> header ( "Location: login.htm" );
> }
> ?>
>
> Question is; is this the way to print of his username?
>
> $username = $_SESSION['username'];
> Echo $username
>
> Or has anyone some alternatives..
>
> This is working o.k. but in my opinion it's a little bit quick and dirty?
>
> Thanks for the comments and suggestions!
>
> Frank
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Rea_David <email protected>: "[PHP] What are the functions to copy a directory structure & then renam e?"
- Previous message: Nenad Djordjevic: "[PHP] Re: safe mode"
- In reply to: Frank Keessen: "[PHP] $_SESSIONS and printing off.."
- Next in thread: Frank Keessen: "Re: [PHP] $_SESSIONS and printing off.."
- Reply: Frank Keessen: "Re: [PHP] $_SESSIONS and printing off.."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

