By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,664 Members | 1,669 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,664 IT Pros & Developers. It's quick & easy.

Server variables

P: n/a
Raj
Hi,

Is there any way of recognising which user has logged in to the site (I have
directory access on the directory) so they will have had to enter their
username & password.

I want to be able to display different links depending on the user who has
entered.

Thanks,
Raj
Jul 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hello, Raj
Hi,

Is there any way of recognising which user has logged in to the site (I have directory access on the directory) so they will have had to enter their
username & password.

I want to be able to display different links depending on the user who has
entered.

Thanks,
Raj


You can use $_SERVER['PHP_AUTH_USER'] for this.

-
Kindest Regards,
Olexiy Merenkov
http://www.merenkov.com/olexiy

Jul 16 '05 #2

P: n/a
Hello Raj :)

if you have database access and you store your username,password
combination in there you might want to explore adding a field to the
table called something like user_directory.

if you go down that path you can easily log in your user against that
table and then pull the value from the field called user_directory .. do
your usual testing, set your $_SESSION and then send them something like

// replace this with your query result
// i use adodb for all my database stuff
$userDir = $result->fields['user_directory'];

header("Location: /path/to/users/".$userDir."/");

header should be sent before anything is output to the screen and if
your unclear on this check out the manual.. and if you are still having
trouble with header() not behaving because of output check out the
output buffering functions like ob_clean.

one last thing.. once youve sent your user to their directory dont
forget that any scripts in that directory should test that the current
session has perms to view those scripts and that data.. for user
authentication i use patUser available at php-tools.de.

(im a fan of api's and wrappers if you can't tell :)

hope that helps. :)

-jpdr
TTG
Raj wrote:
Hi,

Is there any way of recognising which user has logged in to the site (I have
directory access on the directory) so they will have had to enter their
username & password.

I want to be able to display different links depending on the user who has
entered.

Thanks,
Raj


Jul 16 '05 #3

P: n/a
Raj wrote:
Hi,

Is there any way of recognising which user has logged in to the site (I have
directory access on the directory) so they will have had to enter their
username & password.

I want to be able to display different links depending on the user who has
entered.

Thanks,
Raj

$_SERVER['PHP_AUTH_USER'], if i recall correctly.

Jul 16 '05 #4

P: n/a
raj:

didnt read the question properly.. sorry.

MR. Merenkov and Joshua have provided the correct resolution.

sorry guys new to the list and got a bit excited.
-jpdr
TTG
haptiK wrote:
Hello Raj :)

if you have database access and you store your username,password
combination in there you might want to explore adding a field to the
table called something like user_directory.

if you go down that path you can easily log in your user against that
table and then pull the value from the field called user_directory .. do
your usual testing, set your $_SESSION and then send them something like

// replace this with your query result
// i use adodb for all my database stuff
$userDir = $result->fields['user_directory'];

header("Location: /path/to/users/".$userDir."/");

header should be sent before anything is output to the screen and if
your unclear on this check out the manual.. and if you are still having
trouble with header() not behaving because of output check out the
output buffering functions like ob_clean.

one last thing.. once youve sent your user to their directory dont
forget that any scripts in that directory should test that the current
session has perms to view those scripts and that data.. for user
authentication i use patUser available at php-tools.de.

(im a fan of api's and wrappers if you can't tell :)

hope that helps. :)

-jpdr
TTG
Raj wrote:
Hi,

Is there any way of recognising which user has logged in to the site
(I have
directory access on the directory) so they will have had to enter their
username & password.

I want to be able to display different links depending on the user who
has
entered.

Thanks,
Raj


Jul 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.