What a dork
Posts: 15
112 credits Members referred : 0
« on: Apr 28, 2006, 08:09:06 am »
Dear Olaf,
in the access_user class, what's your opinion to say a Welcome to registered users in the scripts? for example, in some pages i don't need to protection, i just wanna say a "Welcome" to users who have loged in. i use the following code, but i get some Warnings!
----header.php---- session_start(); function showheader1 () { if (isset($_SESSION['user'])) { // user has loged in $hello_name = "Welcome ".$_SESSION['user']; } echo($hello_name)." "; --------
the warning i get: Warning: session_start(): Cannot send session cache limiter - headers already sent (output
started at D:\Program Files\Apache Group\Apache2\htdocs\index.php:1) in D:\Program Files\Apache
Group\Apache2\htdocs\header.php on line 3
best regards
Atabak.
p.s. i use showheader function in the index.php script, as below:
after using this code you can echo the variable $hello_name like:
Code:
echo "Hello ".$hello_name." !";
What a dork
Posts: 15
112 credits Members referred : 0
« Reply #2 on: May 11, 2006, 02:47:14 pm »
Dear Olaf, thanks for your reply. this soloution is good only for the registered users that they have loged in before! but in a website, we have visitors who have not loged in! (even not registered) so as a first step we should realize if a user has loged in. what's your opinion as the best way, to check if a visitor has loged in or not!
then we will say Hello to the users who they have loged in to the website.
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
Dear Olaf, thanks for your reply. this soloution is good only for the registered users that they have loged in before! but in a website, we have visitors who have not loged in! (even not registered) so as a first step we should realize if a user has loged in. what's your opinion as the best way, to check if a visitor has loged in or not!
then we will say Hello to the users who they have loged in to the website.
maybe this simple test:
Code:
if (empty($_SESSION['user'])) echo "Hello stranger";
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=2376