Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2003022

[PHP] $_SESSIONS and printing off.. From: Frank Keessen (fkeessen <email protected>)
Date: 02/18/03

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