$REMOTE_USER on the page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pama
Forum Newbie
Posts: 12
Joined: Fri May 30, 2003 8:37 am

$REMOTE_USER on the page

Post by pama »

hi everyone,
anybody knows how to change view of $REMOTE_USER (NT) on the page?
I have

Code: Select all

<?php printf("$REMOTE_USER") ?>
and on the page is "domain_name\\user_name". Is possible to show only "username"?
Thanks :)
stuart
Forum Newbie
Posts: 11
Joined: Thu Apr 24, 2003 8:14 am

Post by stuart »

a quick, easy, answer would be to strip out the domain_name\\ part (if it exists) with regular expressions :)
pama
Forum Newbie
Posts: 12
Joined: Fri May 30, 2003 8:37 am

Post by pama »

not possibile, but really easy :)
anyone?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Try parse_url and Bob or whoever the user is, is your uncle :)
pama
Forum Newbie
Posts: 12
Joined: Fri May 30, 2003 8:37 am

Post by pama »

maybe it's possibile, but...
1. i'm newbie
2. domain name is not url :(
3. i can't do it
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Well you shouldn't need a regular expression for this, explode() could do it:

Code: Select all

$info = explode('\'', $_SERVER['REMOTE_USER']);
$username = $info[1];
echo $username;
Mac
pama
Forum Newbie
Posts: 12
Joined: Fri May 30, 2003 8:37 am

Post by pama »

twigletmac wrote:Well you shouldn't need a regular expression for this, explode() could do it:

Code: Select all

$info = explode('\'', $_SERVER['REMOTE_USER']);
$username = $info[1];
echo $username;
Mac
hi, thanks for this code :D
i can use it but with one change, should be:

Code: Select all

$username = $info&#1111;2];
than i have username without domain name... :)
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Not sure why it's $info[2] - you should only have 2 elements in the array but hey, if it works...

Mac
Post Reply