RE: [PHP] $_SESSIONS and printing off..
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:[EMAIL PROTECTED]] Sent: 18 February 2003 09:00 To: [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
Re: [PHP] $_SESSIONS and printing off..
Thanks, But then another question; if (isset($_SESSION['username']) !empty($_SESSION['username'])) { echo 'Welcome '.$_SESSION['username'].', you are still logged in.'; I want also checked if the level of authentication = 2; for example User Frank = level 1 User Rich = level 2 I've set $_SESSION['level'] to 2 but how can i check that with the above line? Thanks for your help, Frank - Original Message - From: Rich Gray [EMAIL PROTECTED] To: Frank Keessen [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, February 18, 2003 11:53 AM Subject: RE: [PHP] $_SESSIONS and printing off.. 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:[EMAIL PROTECTED]] Sent: 18 February 2003 09:00 To: [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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSIONS and printing off..
Um... how about... echo 'Welcome '.$_SESSION['username'].', you are still logged in and your authentication level is '.(isset($_SESSION['level']) ? $_SESSION['level'] : 'unknown'); Or am I missing something here? Rich -Original Message- From: Frank Keessen [mailto:[EMAIL PROTECTED]] Sent: 18 February 2003 12:15 To: Rich Gray; [EMAIL PROTECTED] Subject: Re: [PHP] $_SESSIONS and printing off.. Thanks, But then another question; if (isset($_SESSION['username']) !empty($_SESSION['username'])) { echo 'Welcome '.$_SESSION['username'].', you are still logged in.'; I want also checked if the level of authentication = 2; for example User Frank = level 1 User Rich = level 2 I've set $_SESSION['level'] to 2 but how can i check that with the above line? Thanks for your help, Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSIONS and printing off..
Uh, sorry for the bad explanation Rich.. Again; ?php session_start(); if (isset($_SESSION['username']) !empty($_SESSION['username'])){ echo 'Welcome '.$_SESSION['username'].', you are still logged in.'; echo $_SESSION['woonplaats']; } else{ header ( Location: login.htm ); } ? This is working fine. But i've set $_SESSION['level'] to value 2 (that's done in the php file that calls this one). Now i want the above code to check for the level and if is not equal to two than go to the else (back to login.htm) statement.. better explained??? ; Thanks, Frank - Original Message - From: Rich Gray [EMAIL PROTECTED] To: Frank Keessen [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, February 18, 2003 1:25 PM Subject: RE: [PHP] $_SESSIONS and printing off.. Um... how about... echo 'Welcome '.$_SESSION['username'].', you are still logged in and your authentication level is '.(isset($_SESSION['level']) ? $_SESSION['level'] : 'unknown'); Or am I missing something here? Rich -Original Message- From: Frank Keessen [mailto:[EMAIL PROTECTED]] Sent: 18 February 2003 12:15 To: Rich Gray; [EMAIL PROTECTED] Subject: Re: [PHP] $_SESSIONS and printing off.. Thanks, But then another question; if (isset($_SESSION['username']) !empty($_SESSION['username'])) { echo 'Welcome '.$_SESSION['username'].', you are still logged in.'; I want also checked if the level of authentication = 2; for example User Frank = level 1 User Rich = level 2 I've set $_SESSION['level'] to 2 but how can i check that with the above line? Thanks for your help, Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSIONS and printing off..
At 13:33 18.02.2003, Frank Keessen said: [snip] This is working fine. But i've set $_SESSION['level'] to value 2 (that's done in the php file that calls this one). Now i want the above code to check for the level and if is not equal to two than go to the else (back to login.htm) statement.. [snip] ?php session_start(); if (isset($_SESSION['username']) !empty($_SESSION['username']) $_SESSION['level'] == 2){ echo 'Welcome '.$_SESSION['username'].', you are still logged in.'; echo $_SESSION['woonplaats']; } else{ header ( Location: login.htm ); } ? -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php