28, May 2012

read user name on an unprotected page ? - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: read user name on an unprotected page ?
« previous next »
Pages: [1] Print

Author Topic: read user name on an unprotected page ?  (Read 1906 times)
Atari ST fan
*
Posts: 8
68 credits
Members referred : 0


« on: Aug 19, 2006, 07:20:42 pm »

Hello,

I  use $_SESSION['user'] and also $user = $test_page_protect->user;  to read the username.
This is working as long as I do this in a protected site.

Now I want to read the user name on an unprotected page. I tried both but I was not successful.
Actually I was not able to use the $test_page_protect->user function without getting Errors.

I was expecting:  If the user is logged in, the username will be returned, if he is logged out, <blank> will be returned.

Can someone help me ? I just want to know which user is logged in when he is accessing an unprotected page.

Thank you,
Philipp
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Aug 19, 2006, 07:37:17 pm »

Hello,

you can access
Code:
$_SESSION['user']

all the time until the user is logged out...

Atari ST fan
*
Posts: 8
68 credits
Members referred : 0


« Reply #2 on: Aug 19, 2006, 08:40:59 pm »

Hello,

I just made a test:
I logged in as a user, accessed a protected page and with $_SESSION['user'] I got the username. Perfect. But when I now access
an unprotected page, $_SESSION['user'] returns <blank> even though the user is still logged on...


Philipp

Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Aug 19, 2006, 09:49:37 pm »

Hello,

I just made a test:
I logged in as a user, accessed a protected page and with $_SESSION['user'] I got the username. Perfect. But when I now access
an unprotected page, $_SESSION['user'] returns <blank> even though the user is still logged on...


Philipp



do you tested this in a new window of internet explorer?

Atari ST fan
*
Posts: 8
68 credits
Members referred : 0


« Reply #4 on: Aug 19, 2006, 10:08:17 pm »

no, in the same window.  (p.s. I also tested it with Firefox and Netscape with the same result).

Philipp
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Aug 20, 2006, 09:01:23 am »

oooh I forgot, since your not using the class there is no session started

just inlude the class or place a session_start at the start of the page.

By the way you can access the methods of the class without protecting a page, its just a feature...

Atari ST fan
*
Posts: 8
68 credits
Members referred : 0


« Reply #6 on: Aug 20, 2006, 12:03:09 pm »

Hi Olaf,

I just placed a session_start() at the beginning and it is working perfectly.
Thank you very much for your quick answers !

Regards,
Philipp
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Aug 20, 2006, 12:44:29 pm »

Hi Olaf,

I just placed a session_start() at the beginning and it is working perfectly.
Thank you very much for your quick answers !

Regards,
Philipp

you're welcome!

Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3734
Tags : firefox Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: read user name on an unprotected page ?
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 03:14:31 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.