5, September 2008

read user name on an unprotected page ? - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ 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 870 times)
Atari ST fan
*
Posts: 8
68 credits
Members referred : 0


« on: Aug 19, 2006, 08: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: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Aug 19, 2006, 08:37:17 PM »

Hello,

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

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


Last blog : Is your website is down? Know before your visitors do!
Atari ST fan
*
Posts: 8
68 credits
Members referred : 0


« Reply #2 on: Aug 19, 2006, 09: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: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Aug 19, 2006, 10: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?


Last blog : Is your website is down? Know before your visitors do!
Atari ST fan
*
Posts: 8
68 credits
Members referred : 0


« Reply #4 on: Aug 19, 2006, 11: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: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Aug 20, 2006, 10: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...


Last blog : Is your website is down? Know before your visitors do!
Atari ST fan
*
Posts: 8
68 credits
Members referred : 0


« Reply #6 on: Aug 20, 2006, 01: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: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Aug 20, 2006, 01: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!


Last blog : Is your website is down? Know before your visitors do!
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3734
Tags : firefox Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


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?
Sep 05, 2008, 02:10:48 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!


Forum Statistics
Total Posts: 36.293
Total Topics: 7.476
Total Members: 3.897
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: FlorianHofmann

23 Guests, 4 Users online :

15 users online today:



Readers

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